jenkins - 具有并行命令的 Jenkins 流水线
问题描述
我有这个基本的詹基斯管道
注意:我省略subJobParams
了保持代码更小
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 }
)
}
}
}
}
外部作业没有并行运行?我究竟做错了什么?
解决方案
查看Build Flow Plugin文档的并行了解详细信息。要添加,以下是我在管道中使用的代码段。
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
}
}
}
}
推荐阅读
- javascript - 反应收集器 - 让用户在嵌入中发布
- java - 使用 Cucumber、Jmeter 和 FailSafe 的自动化框架是否需要 ThreadLocal?
- c++ - 由于#if,Visual Studio Code 智能感知无法识别部分头文件
- python - 如何根据python中的类别改进文件行数计数行
- android - 如何在 Android AccessibilityService 中查找状态栏、导航栏和屏幕的尺寸
- c - C中位的右循环
- pandas - pandas dayofyear 为期 2 年
- javascript - Uber 吃带滚动箭头的 Horizontal ScrollSpy
- swiftui - SwiftUI @EnvironmentObject:未找到?
- r - R C5.0决策树-“c50代码调用退出值为1”错误