#!groovy @Library('globalPipelineLibraryMarkEWaite') _ pipeline { agent { // label 'git-1.8 || git-1.7' // Shows the problem label '!windows && git-1.9+' // Does not show the problem } tools { ant 'ant-latest' } options { skipDefaultCheckout true // Reasonable that SCM vars not defined, since no default checkout? } stages { stage('Build') { steps { echo "Branches[0] is ${scm.branches[0]}" script { scmVars = checkout([$class: 'GitSCM', branches: scm.branches, extensions: [[$class: 'CloneOption', honorRefspec: true, noTags: true, reference: '/var/lib/git/mwaite/bugs/jenkins-bugs.git']], gitTool: scm.gitTool, userRemoteConfigs: [[url: 'ssh://git@github.com/MarkEWaite/jenkins-bugs.git', credentialsId: 'MarkEWaite-github-rsa-private-key-has-passphrase', refspec: '+refs/heads/JENKINS-62534-plink:refs/remotes/origin/JENKINS-62534-plink']]]) sh 'ant info' logContains(expectedRegEx: ".*Git HEAD is ${scmVars.GIT_COMMIT}.*", failureMessage: "Missing checkout return of GIT_COMMIT value '${scmVars.GIT_COMMIT}'") } // Reasonable that env.GIT_COMMIT is not set, since there was no default checkout logDoesNotContain(expectedRegEx: ".*Git HEAD is ${env.GIT_COMMIT}.*", failureMessage: "Missing env GIT_COMMIT value '${env.GIT_COMMIT}'") } } } }