WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+40Lines changed: 40 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,46 @@
2
2
3
3
All notable changes to the Jenkins Diversion SCM Plugin will be documented in this file.
4
4
5
+
> **Note:** Starting December 2025, versions are identified by commit number rather than semantic versioning.
6
+
7
+
## 2025-12-09
8
+
9
+
### Fixed
10
+
-**Automatic duplicate commit prevention**: When a library checkout occurs, the plugin now checks if the pipeline's SCM is configured to use the same Diversion repository. If so, the library writes an empty changelog, preventing duplicate commits in the build status grid. This works automatically without requiring any user configuration changes.
11
+
12
+
### How It Works
13
+
During library checkout, the plugin:
14
+
1. Accesses the pipeline job via `build.getParent()`
15
+
2. Uses reflection to get `CpsScmFlowDefinition` (for "Pipeline script from SCM" jobs)
16
+
3. Extracts the configured SCM's repository ID
17
+
4. Compares with the library's repository ID
18
+
5. If **same repo**: writes empty changelog → prevents duplicates
19
+
6. If **different repo**: writes normal changelog → both changelogs shown
20
+
21
+
### Technical Details
22
+
- Added `getPipelineRepositoryId()` method using reflection to access `WorkflowJob.getDefinition().getScm()`
23
+
- Library checkout stores repo info and checks pipeline config before writing changelog
24
+
- Empty changelog written for same-repo cases: `<changelog></changelog>`
25
+
- Console output shows detection: "Library and pipeline use same repository (dv.repo.xxx) - skipping library changelog"
26
+
27
+
### Tested
28
+
-**Environment**: Local Docker Jenkins (jenkins/jenkins:latest)
29
+
-**Test case**: Pipeline job with `@Library` from same Diversion repo as pipeline script
30
+
-**Before fix**: Build status grid showed "2 commits" (duplicates)
31
+
-**After fix**: Build status grid shows "1 commit" (correct)
32
+
-**Console verification**:
33
+
```
34
+
Pipeline is configured with Diversion repository: dv.repo.ce476570-2c46-4fc4-8c4a-541dd6a6d204
35
+
Library and pipeline use same repository (dv.repo.ce476570-2c46-4fc4-8c4a-541dd6a6d204) - skipping library changelog to prevent duplicates
36
+
```
37
+
38
+
### Improved
39
+
-**README cleanup**: Moved development instructions to DEVELOPMENT.md and version history to CHANGELOG.md
40
+
-**Better troubleshooting docs**: Added troubleshooting entry for duplicate commits issue
41
+
-**Configuration script**: Updated `configure-diversion-library.groovy` to set `includeInChangesets(false)` by default (as a fallback)
Copy file name to clipboardExpand all lines: README.md
+19-97Lines changed: 19 additions & 97 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -96,6 +96,15 @@ The plugin will automatically search for a `.groovy` file matching your job name
96
96
-**Default Branch**: Branch to checkout (dropdown populates automatically)
97
97
-**Library Base Path**: Path to your folder containing `vars/`, `src/`, `resources/` directories (e.g., `Meta/Jenkins/SharedLib`)
98
98
99
+
#### Important: Prevent Duplicate Commits in Changelog
100
+
101
+
**If your pipeline script and shared library are in the same Diversion repository**, you should **uncheck** the "Include @Library changes in job recent changes" option. Otherwise, Jenkins will show duplicate commit entries in the build status grid (one from the library checkout and one from the script checkout).
102
+
103
+
- In the library configuration, uncheck: **"Include @Library changes in job recent changes"**
104
+
- Or when configuring via Groovy script, add: `libraryConfig.setIncludeInChangesets(false)`
105
+
106
+
This is recommended whenever the library is stored in the same repository as your pipeline scripts to avoid confusing duplicate entries.
107
+
99
108
#### Using the Library in Pipeline Jobs:
100
109
101
110
```groovy
@@ -163,69 +172,7 @@ This plugin integrates with the [Diversion API](https://docs.diversion.dev/api-r
163
172
164
173
## Development
165
174
166
-
### Building the Plugin
167
-
168
-
```bash
169
-
# Clean and compile
170
-
mvn clean compile
171
-
172
-
# Run tests
173
-
mvn test
174
-
175
-
# Package plugin (skips tests for faster builds)
176
-
mvn clean package -DskipTests
177
-
178
-
# Run Jenkins with plugin
179
-
mvn hpi:run
180
-
```
181
-
182
-
### Project Structure
183
-
184
-
```
185
-
src/main/java/io/superstudios/plugins/diversion/
186
-
├── DiversionSCM.java # Legacy SCM implementation
187
-
├── DiversionSCMSource.java # Modern SCM (Global Libraries)
188
-
├── DiversionSCMFileSystem.java # File system for library loading
189
-
├── DiversionSCMFileSystemBuilder.java # Builder for file systems
190
-
├── DiversionSCMHead.java # SCM head (branch) representation
0 commit comments