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

查看:23
本文介绍了有没有办法使用 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 Multi-branch pipeline does not schedule标记工作.在那里查看我的答案,复制如下.

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.

简而言之,如果您构建和安装 Jenkins 插件,请访问 https://github.com/AngryBytes/jenkins-build-everything-strategy-plugin 然后你可以添加一个 Build Everything 策略,它会自动构建标签.

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天全站免登陆