Jenkins pipeline branch name returns null

后端 未结 7 796
滥情空心
滥情空心 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条回答
  •  Happy的楠姐
    2021-01-03 23:12

    This variable only works in a multibranch pipline:

    BRANCH_NAME For a multibranch project, this will be set to the name of the branch being built, for example in case you wish to deploy to production from master but not from feature branches.

    I was testing in a normal pipline

提交回复
热议问题