简体   繁体   English

Jenkins管道脚本触发其他管道作业

[英]Jenkins pipeline script to trigger other pipeline jobs

I want to create a parent pipeline job with stages that call trigger other jobs, which are also pipeline jobs. 我想创建一个父管道作业,并在该阶段调用其他触发器作业,这也是管道作业。

Can I achieve this? 我能做到吗?

Here is a skeleton of what I want: Parent job's script: 这是我想要的框架:父级作业的脚本:

pipeline {
  parallel{
    stage("A") {
         build 'name of job 1 which is a pipeline job again and has a parallel block with stages in it'
    }
    stage("B") {
         build 'name of job 2 which is a pipeline job again and has a parallel block with stages in it'
   }
    stage("C") {
         build 'name of job 3 which is a pipeline job again and has a parallel block with stages in it'
   }
 }
}

Does it work this way? 这样行吗? Is there any way to achieve this 有什么办法可以做到这一点

Sure does, This is what we are using, we promote between environments by kicking off the same job from the current execution and don't wait for the result. 当然,这是我们正在使用的,我们通过从当前执行中启动同一作业来在环境之间进行升级,而不必等待结果。

    build(job: "org/${jobName}/${BRANCH_NAME}", 
    parameters: [
        new StringParameterValue('ENV', env),
        new StringParameterValue('ENV_NO', env_no),
        new StringParameterValue('ARTIFACT_NAME', params.ARTIFACT_NAME)
    ],
    propagate: false, 
    wait: false,
)

Refer to the reference for all options https://jenkins.io/doc/pipeline/steps/pipeline-build-step/ 请参考所有选项的参考https://jenkins.io/doc/pipeline/steps/pipeline-build-step/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM