I created a pipeline job and would like to get the svn version number to enable further downstream processing in a call to a shell script. I am using a pipeline script similar to the following:
node {
// Mark the code checkout 'stage'....
stage 'Checkout'
// Get some code from a SVM repository
checkout(
[
$class: 'SubversionSCM',
additionalCredentials: [],
excludedCommitMessages: '',
excludedRegions: '',
excludedRevprop: '',
excludedUsers: '',
filterChangelog: false,
ignoreDirPropChanges: false,
includedRegions: '',
locations: [
[
...
]
],
workspaceUpdater: [$class: 'UpdateUpdater']
]
)
def svnversionnumber=${SVN_VERSION}
sh "/.../someshellscript ${svnversionnumber};"
}
Is there documentation on the checkout function available? Is it possible to get hold of the svn revision number? I can see that the revision is output to the log.
"svn info --show-item revision" will give the current revision to which the current directory is updated.
If you want to write a script which requires no input, you should use the official Subversion command line client instead. checkout a working copy in REV revision: svn checkout --revision REV https://svn.example.com/svn/MyRepo/trunk/ svn checkout https://svn.example.com/svn/MyRepo/trunk/@REV.
Simply type svn update [name-of-directory] , or cd to that directory and type svn update there.
Subversion, with the command line tool svn, is a revision control system, also known as a source code management system (scm) or a source code control system (sccs). The subversion server maintains a repository, where files are stored in a hierarchy of folders, same as a traditional file system.
I had the same issue, but you can solve it by using the map that is returned from calling SCM checkout. It contains a value for SVN_REVISION.
// Get some code from a SVM repository
def scmVars = checkout(
...
)
def svnversionnumber = scmVars.SVN_REVISION
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With