问题
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