简体   繁体   English

Jenkins通过Tag或Master构建

[英]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. 我有一个要求,根据开发人员的兴趣,他可能希望选择从master分支或Tag构建。

I was able to build from tags using the Git parameter plugin. 我能够使用Git参数插件从标签进行构建。 From the git parameter plugin, when I choose Tags or branch, I can see my tags and branches. 从git参数插件中,当我选择“标签”或“分支”时,可以看到我的标签和分支。 But When I select a branch to build from, I get the following git error. 但是,当我选择要生成的分支时,出现以下git错误。

+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 + 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 /标签/来源/母版^ {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. 将所需的标签或分支放入CHECKOUT变量中。 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 在这里,您还可以过滤所有标签,并且只过滤主分支(如果需要)(来源/主)使用此变量作为指定分支从git插件中检出 在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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