我试图通过Jenkins DSL启动项目,但不需要等待它完成。基本上我希望它能够开始一项孤儿工作。
node("slave-node")
{
// Launch pipeline job
stage("LaunchPipelineJob")
{
// this step runs for x mins and does a buch of work
echo "Starting pipelinejob"
def pipelinejob = build job: 'pipelineStep'
//echo "Pipeline job status: ${pipelinejob.result}"
}
// Launch the orphan
stage("LaunchOrphanJob")
{
// need to kick off this job, but dont care to wait for it to finish
echo "Starting orphanPipelinejob"
def orphanPipelinejob = build job: 'orphanStep'
}
}
我查看了dsl,但无法找到有关如何启动孤儿的任何文档。 谢谢
答案 0 :(得分:2)
stage{
build job: 'pipelineStep', parameters: [string(name: 'xxx', value: xxx), string(name: 'yyy', value: yyy)],wait:false
}
stage{
build job: 'orphanStep', parameters: [string(name: 'xxx', value: xxx), string(name: 'yyy', value: yyy)],wait:false
}
仅供参考,当您提供wait = false
时,runwrapper不会返回任何对象,因此您将无法获取与子作业(pipelineStep
和orphanStep
)。
答案 1 :(得分:0)
这应该这样做。
build job: 'pipelineStep', propagate: false, wait: false