[英]convert freestyle job to pipeline
I have the below graph job definition (via downstream) and I want to migrate it to pipeline with parallel options. 我有下面的图形作业定义(通过下游),我想将其迁移到具有并行选项的管道中。
A
/ \
B C
/ \ /
E D
A -> B, C
B -> E, D
C -> D
B and C can run in parallel, D need to wait till B and C finished and E can run after B finished. B和C可以并行运行,D需要等待B和C完成,而E可以在B完成之后运行。
How I can do the same in pipeline ? 我怎样才能在管道中做同样的事情?
I tried the below, but 我尝试了以下内容,但
stage 'Stage 1'
build 'A'
parallel one: {
build 'B'
}, second: {
build 'C'
}
build 'D'
build 'E'
in this configuration E will wait till C job finished. 在这种配置下,E将等到C作业完成。
Well, if you just put build E inside the parallel block with B it will happen when build B is done. 好吧,如果您只是将构建E与B放在并行块中,则将在构建B完成时发生。 I think you can also add wait: false to have the parallel step not wait for the build. 我认为您还可以添加wait:false,以使并行步骤不等待构建。 This might be a problem if you need to build something else after build E, though. 但是,如果您需要在构建E之后再构建其他东西,则可能会出现问题。
stage 'Stage 1'
build 'A'
parallel one: {
build 'B'
build 'E', wait: false
}, second: {
build 'C'
}
build 'D'
You should set node where build should be ececuted: eg 您应该设置执行构建的节点:例如
node {
stage 'Build A'
build 'A'
}
I think this resolve your problems. 我认为这可以解决您的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.