Building/Waiting for parent job Latest version

南笙酒味 提交于 2019-12-08 08:03:42

问题


We have maven projects on git with structure of

--
  pro-A
  --
    pro-B
    --
      pro-C
      pro-D
      --
        pro-E

These are all project with their own repo in git and their own build-pipeline in jenkins with stages as follows

build  -- deploy to TEST -- run tests -- (manual tigger) deploy to QA

every build gets deployed to maven repo with jenkins build number appended to it and merge to release branch from master and tag with the new version number: e.g. 1.0.9-649

So, pro-A is parent of all projects, pro-B only depends on pro-A, pro-C and pro-D are at the same level they don't depend on each other but have dependency on pro-B, pro-E have dependency on all others pro-A,B,C,D

When a change is pushed gitlab triggers a build for the respective project. Now the problem is that when, say A and D changes and Ds build is triggered before a there is a good chance that the build fails as it depends on the newer code of A.

My question is, is it possible to pause the Ds build until A finishes building?

I was thinking something like in pre-step of D try to see if latest commit has a later timestamp than the release branch then trigger a build on parent, but don't know how?


回答1:


There is a way to pause D's build until A finishes. You will have to install: "Parametrized Trigger Plugin". Once installed, go to D's configuration. Under Build, Add build step, select "Trigger/Call builds on other projects".

After that put "A" in "Projects to build" and then check "Block until the triggered projects finish their builds". Save the configuration.

This should fulfill your requirement.



来源:https://stackoverflow.com/questions/27483322/building-waiting-for-parent-job-latest-version

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!