Reputation: 53
I would like to read the revision number from Jenkins job when the job fails
Revision number:
Job script:
failure {
echo 'JENKINS PIPELINE FAILED'
notifyBitbucket
commitSha1: "${env.SVN_REVISION}",
considerUnstableAsSuccess: false,
credentialsId: 'UFCBitbucket',
disableInprogressNotification: true,
ignoreUnverifiedSSLPeer: true,
includeBuildNumberInKey: false,
prependParentProjectKey: false,
projectKey: '',
stashServerBaseUrl: 'https://bitbucket.url.local:8080'
}
I have trouble with Jenkins environment variable - "${env.SVN_REVISION}". This variable returns null value.
I can not solve this problem. Please help to solve this problem Thanks in advance
Upvotes: 1
Views: 454
Reputation: 5266
I don't think the env-variable SVN_REVISION
does even exist.
All available Git-plugin env-variables can be seen here (and the Jenkins' ones here).
I would suggest you use the following environment-variable to get the revision:
GIT_COMMIT - SHA1 of the commit used in this build
On the other hand you can get the revision also by executing the git command directly per sh / bash:
git rev-parse HEAD
Upvotes: 1