詹金斯“标记”用 git 构建

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13117736/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 14:50:23  来源:igfitidea点击:

Jenkins "tag" build with git

gitjenkins

提问by Michael Wiles

There is an option on jenkins when using git to "tag" the build.

使用 git 来“标记”构建时,jenkins 有一个选项。

What does this do and how do I use it? I assume I can tag the build at that version but I'm struggling to figure out how to push that tag - it's not so useful unless I can push the tag.

这有什么作用以及如何使用它?我假设我可以在该版本上标记构建,但我正在努力弄清楚如何推送该标签 - 除非我可以推送该标签,否则它不是很有用。

采纳答案by VonC

You don't always want to push allthe build tags, because there could be a lot of them, depending on your build cycle.

您并不总是想要推送所有构建标签,因为可能有很多标签,具体取决于您的构建周期。

But any task scheduler (like Jenkins) will tag a build in case you want to get back to that specific code and debug it (because even though the build might have succeeded, the end result might have run poorly)

但是任何任务调度程序(如 Jenkins)都会标记构建,以防您想返回到该特定代码并对其进行调试(因为即使构建可能成功,最终结果也可能运行不佳)

That said, should you want to push those tags, you can use, as mentioned in "Tagging a GitHub project through Jenkins", a post-build action (git push --tags).
Or, as mentioned in the ticket JENKINS-12156, use the GitPublisher (as illustrated in "Git, Feature Branches, and Jenkins – or how I learned to stop worrying about broken builds").

也就是说,如果您想推送这些标签,您可以使用构建后操作 ( ) ,如“通过 Jenkins 标记 GitHub 项目”中所述git push --tags
或者,如票证 JENKINS-12156 中所述,使用 GitPublisher(如“ Git、Feature Branches 和 Jenkins – 或者我如何学会不再担心损坏的构建”中所述)。