如何在Jenkins构建工作管道?
在我的项目中,我有3个网络应用程序,都依赖于一个 all-commons
项目。
In my project, I have 3 web-applications, all depend on one all-commons
project.
all-commons_RELEASE , web-A_RELEASE
, web-B_RELEASE
和 web-C_RELEASE
。
这些作业的作用是构建部署在我们的Nexus上的工件。然后,有人在Nexus中检索这些工件,并将它们部署在我们的开发/同源服务器上。
In my Jenkins server, I built 4 jobs, all-commons_RELEASE
, web-A_RELEASE
, web-B_RELEASE
and web-C_RELEASE
.
The role of these jobs is to build the artifacts, which are deployed on our Nexus. Then, someone retrieve these artifacts in Nexus and deploy them on our dev / homologation servers.
我想要的是有一个4构建,以顺序的方式。
这样,一旦此作业完成,所有RELEASE作业都已执行。
当然,如果一个构建失败,进程停止。
What I want, is to have one (additional?) job that will launch all the 4 builds, in a sequential way. This way, once this job is finished, all the RELEASE jobs have been executed. Of course, if one build fails, the process is stopped.
我的第一个想法是指示 web-A_RELEASE 的后构建操作的构建其他项目列表中的code>
然后, web-B_RELEASE
依赖于 web-A_RELEASE
,等等。
My first thought was to indicate the web-A_RELEASE
in the Build other projects list of the Post-build Actions of all-commons_RELEASE
.
Then, web-B_RELEASE
is dependent on web-A_RELEASE
, and so on.
但是,我想要能够单独启动它们中的任何一个,这是不可能的,如果我指示对项目的依赖。例如,如果我手动启动 web-B_RELEASE
,然后将构建 web-C_RELEASE
我想要的...
However, I want to be able to start any of them separately, which is not possible if I indicate a dependency on the projects. For example, if I manually start web-B_RELEASE
, then web-C_RELEASE
will be built after that, which is not what I want...
你有什么想法如何实现,或者一个插件来帮助我这样做?
Do you have any idea how I can achieve that, or a plugin to help me to do that?
注意。
ps:Jenkins 1.430,所有RELEASE作业都是自由样式项目(他们混合Maven和bash命令)。
ps: Jenkins 1.430, and all RELEASE jobs are free-style projects (they mix Maven and bash commands).
也许你可以使用 Parametrized Trigger Plugin ?
使用插件,您可以将触发器设置为管道作业中的构建步骤。有一个复选框阻止,直到触发作业完成,你需要激活。您可以简单地配置您的三个作业以这种方式触发,并且触发只会发生,如果你运行这个新的管道作业,所以运行其他作业没有触发任何东西都会正常工作。
Using the plugin you can set the trigger as a build step in your "Pipeline" Job. There is a checkbox "Block until triggered job is finished", which you need to activate. You could simply configure your three jobs to be triggered this way, and the triggering would only occur if you run this new Pipeline Job, so running the other jobs without triggering anything would work fine.
这应该是你需要的。