Jenkins pipeline branch name returns null

后端 未结 7 838
滥情空心
滥情空心 2021-01-03 22:25

I\'m trying to get the name of my branch for a jenkins groovy script. I cannot get the current branch name. I try the following:

stage(\'Check out code\')
ch         


        
7条回答
  •  佛祖请我去吃肉
    2021-01-03 22:56

    In the pipeline job I'm using env.GIT_BRANCH which resolves to origin/{BRANCH}

    In the case of a multibranch job, env.GIT_BRANCH resolves to {BRANCH} (no origin/).

提交回复
热议问题