詹金斯管道与并行命令 [英] Jenkins Pipeline With Parallel Command

查看:89
本文介绍了詹金斯管道与并行命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个基本的jenkis管道

I have this basic jenkis Pipeline

注意:我省略了 subJobParams 来使代码更小

Note: I omitted subJobParams to keep code smaller

pipeline {
    agent any 
    stages {

        stage('stage1') {
            steps {
                script {
                    parallel (
                                "mongoParallel" : { build job: 'mongo', parameters: subJobParams },
                                "elasticsearchParallel" : { build job: 'elasticsearch', parameters: subJobParams }
                                "redisParallel" : { build job: 'redis', parameters: subJobParams }

                    )
               }
          }
      }
  }

外部作业不是并行运行的吗?我在做什么错?

The external jobs are not running in parallel? What am I doing wrong?

推荐答案

检查构建流插件文档的并行部分以获取详细信息。
要添加,下面是我在管道中使用的代码段。

Check the Build Flow Plugin documentation's parallel for details. To add, below is the snippet that I'm using in my pipelines.

stage('Name') {
  steps {
    script{
      container('tools') {
          parallel job1: {
              build job: 'path/to/the/job', parameters: [string(name: 'command', value: 'command-out')]
          }, job2: {
              build job: 'path/to/the/job', parameters: [string(name: 'command', value: 'command-out')]
          }, job3: {
              build job: 'path/to/the/job', parameters: [string(name: 'command', value: 'command-out')]
          }, job4: {
              build job: 'path/to/the/job', parameters: [string(name: 'command', value: 'command-out')]
          },
          failFast: true
      }
    }
  }
}

这篇关于詹金斯管道与并行命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆