war*_*que 6 jenkins jenkins-pipeline
我想允许并行运行以下管道,但由于资源有限,我必须限制并行运行的最大数量。
pipeline {
agent { label "$JENKINS_AGENT" }
parameters { .. }
options { .. }
stages {
stage('Checkout') { .. }
stage('Config') { .. }
stage('Deploy') { .. }
stage('Test') { .. }
}
post {
failure { .. }
success { .. }
always {
cleanup()
}
}
}
Run Code Online (Sandbox Code Playgroud)
例如,如果我仅限于 3 个部署,我该如何实现这一目标?
编辑:我目前已将以下内容添加到我的 jenkinsfile 中。似乎有效,但我不确定这是否是正确的方法。(使用Throttle 并发构建插件)
properties([
[
$class: 'ThrottleJobProperty',
categories: ['parallel_pipeline'],
limitOneJobWithMatchingParams: false,
maxConcurrentPerNode: 3,
maxConcurrentTotal: 3,
paramsToUseForLimit: '',
throttleEnabled: true,
throttleOption: 'project'
],
])
Run Code Online (Sandbox Code Playgroud)
您可能会发现这些插件很有用:
| 归档时间: |
|
| 查看次数: |
13745 次 |
| 最近记录: |