I have a command that retrieves my most recent git commit hash.
git rev-parse HEAD
Is it possible to pass this as an environment variable to a Jenkins pipeline stage?
I've tried to do this,
environment {
CURRENT_COMMIT_HASH=`git rev-parse HEAD`
}
but when I echo it in a later stage
stage ('Issues Report') {
steps {
sh '''
echo "${CURRENT_COMMIT_HASH}"
'''
}
}
It comes out blank.
+ echo