具有并行命令的 Jenkins 流水线 [英] Jenkins Pipeline With Parallel Command
本文介绍了具有并行命令的 Jenkins 流水线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这个基本的 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?
推荐答案
检查 Build Flow Plugin 文档并行了解详细信息.要添加,下面是我在管道中使用的代码段.
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
}
}
}
}
这篇关于具有并行命令的 Jenkins 流水线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文