Duplicate changes in jenkins pipe script with svn

This question is basically the same as this , except that I'm using subversion, and no update to the plugin did the trick for me.

I upload my Jenkins script file with a multi-brand pipeline setting, and the change log is duplicated with every new checkout scm .

Since in my assembly I use several workspaces selected through node inside parallel blocks, I call fresh checks for each of them, and duplication of changes becomes a little annoying.

+5
source share
3 answers

Building on the same problem.

I do the following until the patch for the SVN plugin is fixed.

 currentBuild.getChangeSets().clear() checkout scm 

Note: you may need to approve script calls through the "In-process script approval" page.

This will clear the change log from Jenkins Job. The change log will again be populated with a checkout scm call. UPDATE. Check out my changes below. This “solution” does not work because it adds back the deleted revisions after the reboot ... I don’t understand why, but ...

EDIT:

Now I have found a new way:

 for(i = 0; i < scm.getLocations().length; i++) { def location = scm.getLocations()[i] def svn_url = location.remote checkout changelog: false, poll: false, scm: [$class: 'SubversionSCM', additionalCredentials: [], excludedCommitMessages: '', excludedRegions: '', excludedRevprop: '', excludedUsers: '', filterChangelog: false, ignoreDirPropChanges: false, includedRegions: '', locations: [[credentialsId: '252ad9ab-2f39-46f5-a77a-6196d1679dee', depthOption: 'infinity', ignoreExternalsOption: true, local: '.', remote: svn_url]], workspaceUpdater: [$class: 'UpdateWithRevertUpdater']] } 

You must use the Piping Syntax page to get the correct credentials. I tried to use only

 checkout changelog: false, scm 

but it didn’t work. Therefore, you need to use the long version shown above.

+5
source

Ben Herfurt's answer is good, I’ll just send the final adaptation, because I tried to wrap it a bit in one working function.

This function works for me, since I have only one SVN repository to check, and all the rest (for example, passwords) are already configured:

 def checkout(){ def svnLocation = scm.locations[0] checkout(changelog: false, scm: [$class: 'SubversionSCM', locations: [svnLocation], workspaceUpdater: [$class: 'UpdateWithCleanUpdater']]) } 

I just turn to this wherever I need a new working copy.

 node('linux') { checkout() // ... run ITs on linux ... } node('windows') { checkout() // doesn't duplicate changelog anymore // ... run ITs on windows .... } 

Hope this helps others.

+3
source

Instead of overriding the SCM class, you can still access the original "scm" object and turn off the change log as follows:

 checkout(changelog: false, scm: scm) 

This will preserve the intended "checkout scm" mode when disabling change generation.

+3
source

All Articles