Get branch name in case of pull request jenkins multibranch pipeline

2.1k views Asked by At

I am using Jenkins multibranch pipeline pull request feature when i print env.BRANCH_NAME it prints PR-pullrequestnumber. instead of that i want to get branch name how could i get it ?

2

There are 2 answers

2
Ginanjar R. On

You will get the exact branch name after merging the code. It's just to differ

1
Pete On

I was able to get the branch name from env.CHANGE_BRANCH in case of a pull request.