jenkins BRANCH_NAME变量不再有效

时间:2017-02-10 06:54:25

标签: jenkinsfile

我有这个jenkins文件,我在jenkins上运行

node("MacMiniSlave") {
  try{
  withEnv(["PATH=${env.HOME}/.rbenv/versions/2.3.1/bin:${env.PATH}","http_proxy=http://proxy.singaporepower.com.sg","https_proxy=http://proxy.singaporepower.com.sg","LANG=en_US.UTF-8","LANGUAGE=en_US.UTF-8"]){
      sh "env"
      echo "My branch is: ${env.BRANCH_NAME}"
    }
    currentBuild.result='SUCCESS'
  }catch(Exception e){
    currentBuild.result="FAILURE"
    throw e
  }finally{
    step([$class: 'GitHubCommitNotifier', resultOnFailure:'FAILURE'])
  }
}

但是这个输出是My branch is: null。为什么会这样?

0 个答案:

没有答案