简体   繁体   English

是否可以在 jenkins 管道的并行阶段运行相同的 jenkins 构建作业

[英]Is it possible to run a same jenkins build job in parallel stages in jenkins pipeline

I have a jenkin job name called A .我有一个名为A的詹金工作名称。 I want this to run in parallel on different nodes in jenkins pipeline.我希望它在 jenkins 管道中的不同节点上并行运行。 When i try to run this, my job is in queue even when i try to run in different node.当我尝试运行它时,即使我尝试在不同的节点中运行,我的工作也在队列中。

sample code is below.示例代码如下。 I have added exact syntax of build job inside steps.我在步骤中添加了构建作业的确切语法。 For demonstration purpose i have added comments only.出于演示目的,我仅添加了评论。 Thanks for help in advance提前感谢您的帮助

pipeline{
 agent none
   stages{
     stage("A"){
       parallel{
         stage("A1"){
            agent{
               label 'node a'
            }
            steps{
              // build job with name A
           }

         }
         stage("A2"){
            agent{
               label 'node b'
            }
            steps{
              // build job with name A
           }

         }


       }

     }

   }

}

You can add a fake parameter to the job, and then call it with different value for the parameter for each call.您可以向作业添加一个假参数,然后为每次调用使用不同的参数值调用它。 This will force it to call the same job twice.这将迫使它两次调用同一个作业。

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

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