我正在使用jenkins git插件,如下面的管道代码(groovy)所示。检出有效,但未设置环境变量。
node(){
dir("${WORKAREA}") {
//checkout uses mirror repo to make creation of new repo faster and smaller
//clean is done after checkout (rsync was doing this part)
performCheckout(REPO,BRANCH,BITBUCKET_PROJECT_URL,UNIVERSAL_REFERENCE_REPO_PATH)
sh("env")
}
}
private void performCheckout(REPOSITORY,String BITBUCKET_PROJECT_URL,String UNIVERSAL_REFERENCE_REPO_PATH) {
//standard plugin for checkout
checkout changelog: true,poll: false,scm: [$class : 'GitSCM',branches : [[name: "refs/remotes/${REPOSITORY}/${BRANCH}"]],doGenerateSubmoduleConfigurations: false,extensions : [[$class : 'CloneOption',depth : 1,noTags : true,reference: "${UNIVERSAL_REFERENCE_REPO_PATH}",shallow : false,[$class : 'SparseCheckoutPaths',sparseCheckoutPaths: [
[path: '!/tests/*'],[path: '/*']]],[$class: 'CleanCheckout',timeout: 40],[$class: 'CheckoutOption',timeout: 75]],gitTool : 'Default',submoduleCfg: [],userRemoteConfigs : [
[credentialsId: 'privatekey',name : "${REPOSITORY}",url : "${BITBUCKET_PROJECT_URL}/${REPOSITORY}.git"]
]]
}
当我在管道中打印env( sh(“ env”))时,它不会打印GIT_ *环境变量。知道怎么了吗?