0

I am using Jenkins 2.277 and when trying to create a pipeline script that has GIT_BRANCH or BRANCH_NAME, it's giving null values and I have conditions in the script that checks for master/develop branch and run the script accordingly. Because the GIT environment variables seems to be giving null value, it is not running the script as desired. I have seen online that this was a bug within Jenkins and I saw some workarounds which didn't work for me.

Is this issue still not fixed in Jenkins Pipeline? Is there any solution for this? I am planning to use multibranch pipeline. But wanted to check if there is any existing solution for non-multibranch pipeline in accessing the git environment variables.

acm
  • 67
  • 8
  • 1
    Does this answer your question? [How to access git branch name from pipeline job?](https://stackoverflow.com/questions/39589360/how-to-access-git-branch-name-from-pipeline-job) – Noam Helmer Sep 02 '21 at 14:13

0 Answers0