// ...
// Retrieving first 6 characters of the SHA Git commit id.
def getCommit() {
def command="git rev-parse HEAD > " + this.workspace + "/GIT_COMMIT"
script.sh(command)
script.readFile(this.workspace + "/GIT_COMMIT").take(6)
}
// ...
stage 'Get Code'
checkout([$class: 'GitSCM', branches: [[name: treeish]],
doGenerateSubmoduleConfigurations: false,
submoduleCfg: [],
userRemoteConfigs: [[credentialsId: 'XXXXXXXXXXX_CREDENTIALS',
url: 'ssh://git@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxt']]])