We use Git, jenkins and python at office.
We build a new SW version on a daily basis using jenkins.
How can I get the branch name to which the build belongs using Python from Jenkins?
Is there any API (function call) in Jenkins that can I give the build number as an argument, and it gives me the branch number?
Temporary solution
We also have a git tag for each build, in the following format:
<build>_<username>_<branch>
I currently use the following git command to get the tag:
git ls-remote --tags <git-repo> | grep BUILD-NUMBER
Once I have the tag, I extract the branch name from it using regex.
Thanks in advance.