有没有一种方法可以使用Multibranch Pipeline Jenkins插件自动构建标签? [英] Is there a way to automatically build tags using the Multibranch Pipeline Jenkins plugin?

查看:165
本文介绍了有没有一种方法可以使用Multibranch Pipeline Jenkins插件自动构建标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Jenkins中创建多分支管道之后,我可以轻松地告诉它轮询任何分支的更改或添加,并且它将自动为这些分支创建作业并建立这些分支.我告诉Multibranch作业也要发现标签,因此它会自动为每个标签创建作业,这很棒.

After creating a Multibranch Pipeline in Jenkins I can easily tell it to poll for changes or additions of any branches and it will automatically create jobs for and build those branches. I told the Multibranch job to also discover tags, so it automatically creates jobs for each tag, which is great.

Jenkins是否也有一种自动构建这些标签的干净方法,而无需我手动触发它们?正如您在下面看到的那样,标记的工作在那里,但是我必须手动构建它.

Is there a clean way for Jenkins to automatically build those tags as well, instead of me having to trigger them manually? As you can see below, the job for the tag is there, but I have to manually build it.

推荐答案

我会对此发表评论,但我的声誉不足.我相信这是 Jenkins多分支管道未计划的副本标记作业.在下面查看我的答案.

I would have commented with this, but I don't have enough reputation. I believe this is a duplicate of Jenkins Multi-branch pipeline doesn't schedule tag jobs. See my answer there, copied below.

简而言之,如果您构建并安装了位于 https:/上的Jenkins插件, /github.com/AngryBytes/jenkins-build-everything-strategy-plugin ,然后您可以添加构建一切"策略,该策略将自动构建标签.

In short, if you build and install the Jenkins plugin available at https://github.com/AngryBytes/jenkins-build-everything-strategy-plugin then you can add a Build Everything strategy which will automatically build tags.

根据 JENKINS-47496的设计,似乎不会自动触发针对已发现标签的构建.斯蒂芬·康诺利(Stephen Connolly)对您可能会做的事情提供了解释和建议:

Not automatically triggering a build for discovered tags seems to be by design according to JENKINS-47496. Stephen Connolly offers an explanation and suggestion for what you might do:

Stephen Connolly添加了评论-6天前

Stephen Connolly added a comment - 6 days ago

默认情况下未构建代码(因为否则您可能会有一个 签出存储库时会产生风暴),更糟糕的是,订单标签 将无法预测...并且您可能会有一个Jenkinsfile 构建代码后将部署到生产环境.

Tags are not built by default (because otherwise you could have a build storm when checking out a repository) and worse, the order tags will be built in is unpredictable... and you might have a Jenkinsfile that deploys to production when a tag is built.

branch-api中有一个扩展点,称为BranchBuildStrategy 如果实施,则可以决定是否构建标签.

There is an extension point in branch-api called BranchBuildStrategy which - if implemented - will allow deciding whether to build tags.

请参阅 https://github.com/jenkinsci/github-branch -source-plugin/pull/158#issuecomment-332773194 关于如何创建这样的扩展插件的起点...我 相信有人在做一些工作 https://github.com/AngryBytes/jenkins-build-everything-strategy-plugin

See https://github.com/jenkinsci/github-branch-source-plugin/pull/158#issuecomment-332773194 for starting point on how to create such an extension plugin... I believe there is some work on one at https://github.com/AngryBytes/jenkins-build-everything-strategy-plugin

这篇关于有没有一种方法可以使用Multibranch Pipeline Jenkins插件自动构建标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆