简体   繁体   English

如何避免Jenkins在构建另一个分支时认为该构建是固定的?

[英]How to avoid Jenkins think the build is fixed when it builds another branch?

We use the git plugin to build all the branches of our repo ( Branch specifier is ** ). 我们使用git插件构建git所有分支( Branch specifier** )。

The problem is if branch A breaks, we get notified by email. 问题是,如果分支A中断,我们会通过电子邮件收到通知。

However, if someone pushed to branch B and it builds correctly, then we get a second email telling use "Build back to normal". 但是,如果有人推送到分支B并正确构建,那么我们会收到第二封电子邮件,告知使用“构建回正常”。

But the branch A is still broken, yet we think all is good. 但是分支A仍然坏了,但是我们认为一切都很好。

Is there a way to make the "email notifier" (and Jenkins) understand that the build is still broken for a branch? 有没有一种方法可以使“电子邮件通知程序”(和Jenkins)了解分支的构建仍被破坏?

Or is there another approach to build all branches , even new ones, automatically? 还是有另一种自动构建所有分支 (甚至是新分支)的方法?

You should create a build per branch. 您应该为每个分支创建一个版本。

First, you should setup a sync job that creates the jobs automatically if a new branch is created. 首先,您应该设置一个同步作业,如果创建了新分支,该作业将自动创建作业。 You will want to use these scripts/plugins: http://entagen.github.io/jenkins-build-per-branch/ 您将要使用以下脚本/插件: http : //entagen.github.io/jenkins-build-per-branch/

Then you will receive notifications per branch instead of the entire repository. 然后,您将收到每个分支的通知,而不是整个存储库的通知。 We do this for our project and it works great. 我们为我们的项目这样做,并且效果很好。 We went a little further and spin up staging environments per branch as well. 我们走得更远,并且每个分支也增加分级环境。

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

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