手动触发的构建和计时器触发的构建的构建后触发器不同

发布于 2024-12-27 14:34:52 字数 205 浏览 4 评论 0原文

简而言之,我在 Jenkins 中有一个用于检查和构建代码的“构建发布”(BR) 项目,以及一个用于测试此代码的“全面测试”(FBT) 项目。

晚上,BR项目由定时器触发,我需要BR项目在完成后触发FBT项目。但是,如果我手动触发 BR 项目,我希望随后触发 FBT 项目,因为这会从构建服务器占用太多资源。

有没有办法在詹金斯中实现这一目标?

Simplified, I have a "build release" (BR) project in Jenkins that checks out and builds code, and a "full-blown test" (FBT) project that tests this code.

At night, a BR project is triggered by a timer, and I need the BR project to trigger the FBT project when it's done. However, if I trigger a BR project manually, I don't want the FBT project to be triggered afterwards, because that takes too much resources from the build server.

Is there a way to achieve this in Jenkins?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浊酒尽余欢 2025-01-03 14:34:53

解决此问题的几种方法:

解决方案 1

  1. 向您的 BR 项目添加一个参数,一个名为 TriggerFBT 的布尔值。默认值为“已检查”。
  2. 在 BR 项目中,使用 Conditional BuildStep Plugin 检查触发FBT参数。如果已启用,请添加构建步骤(参数化触发器插件)到运行 FBT 作业。请注意,您希望将其作为构建步骤,而不是构建后/发布之类的事情。

当您手动触发 BR 作业时,您需要记住取消选中 TriggerFBT 参数。由于默认勾选了 TriggerFBT,因此当通过定时器触发 BR 项目时,最终会触发 FBT 项目。

解决方案 2

  1. 从 BR 项目中删除计时器触发器。
  2. 创建一个新作业 - 将其命名为 TimerBR。将计时器触发器添加到 TimerBR。
  3. 在构建步骤中,使用参数化触发器插件首先执行BR项目,等待其完成,然后执行FBT项目。

Couple ways to solve this problem:

Solution 1

  1. Add a parameter to your BR project, a boolean called TriggerFBT. Default value is CHECKED.
  2. In the BR project, use the Conditional BuildStep Plugin to check the TriggerFBT parameter. If eanbled, add a build step (Parameterized Trigger Plugin) to run the FBT job. Note that you want it as a BUILD STEP, not as a post-build/publish sort of thing.

When you manually trigger the BR job, you'll need to remember to uncheck the TriggerFBT parameter. Because TriggerFBT is checked by default, when the BR project is triggered via timer, the FBT project will eventually get triggered.

Solution 2

  1. Remove the timer trigger from the BR project.
  2. Create a new job - call it TimerBR. Add the timer trigger to TimerBR.
  3. In the build steps, use Parameterized Trigger Plugin to first execute the BR project, wait for it finish, then execute the FBT project.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文