If I set in Jenkinsfile:
options { skipDefaultCheckout() }
then in steps in pipeline below, variable ${env.GIT_URL}
appeared do not available. For example cannot complete step:
stage('Clean checkout') {
steps {
checkout([$class: 'GitSCM', branches: [[name: "master"]],
userRemoteConfigs: [[url: "${env.GIT_URL}"]]])
}
}
in this step variable ${env.GIT_URL}
= null due to build console log.
But if you enable back default checkout, so delete:
options { skipDefaultCheckout() }
Then ${env.GIT_URL}
became available. Is it expected behaviour? I cannot see Git plugin variables in Pipeline where disabled declarative checkout?
It is the expected behavior. Source: https://issues.jenkins.io/browse/JENKINS-66803?focusedCommentId=414193&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-414193