Triggering upstream project builds before downstream project

六月ゝ 毕业季﹏ 提交于 2019-12-04 00:07:58

问题


I have the following project layout:

  • WAR Project A
    • Upstream Projects
      • Dependency B
      • Dependency C
      • Dependency D

I'm looking to setup A so that every time I want to trigger a build, it will first build B, C, and D. If either builds for B, C, or D fail then A's build should fail as well.

It seems like a common build case, but I'm not sure how to accomplish it. There are the following options but they don't seem to have the right relationship:

  • Build Triggers - Build after other projects are built
    • Will build the current project after some upstream projects, but I need to control the build from this project since I'm doing a WAR deployment. I just want to always build dependencies first.
  • Post-build Actions - Build other projects
    • Will build projects after this one, but that's backwards for what I want to do.

Is there a build configuration in Hudson (or through a plugin) that will work for me?


回答1:


This came up on the Hudson mailing list very recently. There is no direct support for this type of build configuration in Hudson.

See this thread: http://jenkins.361315.n4.nabble.com/On-demand-build-dependency-handling-simple-2-job-build-td624395.html

You could use the Join plugin to create a 'build+deploy' job. It would have B,C and D as downstream projects, and then 'A' would become the join target.

Thus B C and D would need to complete successfully. If so, then the plain 'deploy' job of A would be launched. If there were any error, A would not launch. This is effectively the same as what you are asking for.

You can read about the join plugin here: http://wiki.hudson-ci.org/display/HUDSON/Join+Plugin




回答2:


Take a look at the Apache Ivy project (http://ant.apache.org/ivy/). It handles project dependencies very well, and it has a plugin for Hudson. From the way you describe the problem, I think this solution would work for you.




回答3:


I think the Join Plugin, is what you are looking for. so you setup the A-Trigger job who triggers B,C,D and waits until all are finished and than A gets triggered.




回答4:


I have a similar project layout and found after a little bit research the following answeranswer How do I trigger another job from hudson as a pre-build step?.
A plugin which will perhaps work in the future is the PreBuild Plugin.



来源:https://stackoverflow.com/questions/1848764/triggering-upstream-project-builds-before-downstream-project

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