打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
Jenkins

How can I trigger a parameterized build only if the parent finished successfully AND it had changes (changes pushed to scm)?

Here is a scenario: I have 3 builds: A, B and C. B will built if it is called by A or it has changes. C should be built only if B finished successfully and if B was built because of scm changes and NOT because it was triggered by A

Thanks

asked Jul 17 at 21:00
kazerm
1096

Add to A:

Post-build ActionsTrigger parameterized build on other projects:

  • Projects to build: B
  • Trigger when build is: Complete (always trigger)
  • Add parametersPredefined parameters: A_HAS_BEEN_BUILT=YES

Add to B:

Meta Data → [?] This build is parameterized → Add parameterString parameter:

  • Name: A_HAS_BEEN_BUILT
  • Default value: NO

Post-build ActionsTrigger parameterized build on other projects:

  • Projects to build: C
  • Trigger when build is: Stable [the default anyway]
  • Add parametersPredefined parameters: A_HAS_BEEN_BUILT=${A_HAS_BEEN_BUILT}

Add to C:

Meta Data → [?] This build is parameterized_ → Add parameterString parameter:

  • Name: A_HAS_BEEN_BUILT
  • Default value: NO

BuildAdd Build stepConditional step (single):

  • Run?: Not
  • !: Regular expression match
    • Expression: ^YES$
    • Label: ${ENV,var="A_HAS_BEEN_BUILT"}
  • Builder: ... according to your needs ...


See Parameterized Build, Parameterized Trigger Plugin and Run Condition Plugin.

UPDATE 1

The settings given above induce the following:

  1. A builds → B builds → B is stable → C starts, but doesn't build
  2. B polls SCM → SCM changes → B builds → B is stable → C builds

According to the discussion the following is intended:

  1. A builds → B builds
  2. B polls SCM → SCM changes → B builds → B is stable → C builds

UPDATE 2

To prevent C from being triggered at 1.:

  • Create an upstream project to B that polls the SCM and triggers B

  • Configure the following in B:

    Source Code Management → ? None

    Build Triggers

    • [   ] Poll SCM

    BuildAdd Build stepConditional step (single):

    • Run?: Execute shell / Execute Windows batch command
      • Command: ... SCM checkout commands; set exit status / ERRORLEVEL greater than 0 in case of no SCM changes ...
    • Builder: Trigger/call builds on other projects
      • Build Triggers
        • Projects to build: C
answered Jul 18 at 14:51
Gerold Broser
2,6251927
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
hudson 构建触发器说明
Jenkins(三)
Jenkins job 之间实现带参数触发
Build built 隈研吾2008中国展 展览现场2
Bitbucket | The Git solution for professional team...
Theme List
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服