简体   繁体   中英

Jenkins Build from Tag or Master

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?

This worked for me: 在此处输入图片说明

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 在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM