0
votes

I have a requirement where depending on the interest of the developer, He might want to choose to build from master branch or Tag.

I was able to build from tags using the Git parameter plugin. From the git parameter plugin, when I choose Tags or branch, I can see my tags and branches. But When I select a branch to build from, I get the following git error.

+refs/tags/:refs/remotes/origin/tags/ +refs/heads/master:refs/remotes/origin/master 00:00:02.508 > git rev-parse refs/remotes/origin/tags/origin/master^{commit} # timeout=10 00:00:02.549 > git rev-parse refs/remotes/origin/origin/tags/origin/master^{commit} # timeout=10 00:00:02.590 > git rev-parse origin/tags/origin/master^{commit} # timeout=10

Can someone please help me to achieve the above requirement in one Jenkins Job?

1

1 Answers

2
votes

This worked for me: enter image description here

Put the desired tag or branch in the CHECKOUT variable. Here you can also filter on all tags and only the master branch if you want (origin/master) Use this variable as specified branch to checkout from in the git plugin enter image description here