lki*_*sac 2 jenkins jenkins-pipeline
我的管道中有一个输入阶段,我希望仅在满足特定条件时才运行。
stage ('input stage') {
agent none
when {
expression {
condition1 == "YES"
}
}
input {
message 'Proceed with this step?'
submitter "${approvers}"
}
steps {
echo "Proceeding with step..."
}
}
Run Code Online (Sandbox Code Playgroud)
然而,即使不满足条件,输入阶段也会等待提交者批准。
我假设这对于有输入的阶段是可能的。上面的代码块有问题吗?
提前致谢。
没有“问题”,这只是声明性管道的输入指令的工作方式(强调我的):
舞台上的输入指令允许您使用输入步骤提示输入。应用任何选项后、进入该阶段的代理块或 评估该阶段的条件之前,该阶段将暂停。如果输入获得批准,该阶段将继续进行。
要检查when之前的条件input,请转入input步骤:
stage ('input stage') {
agent none
when {
expression {
condition1 == "YES"
}
}
steps {
input message: 'Proceed with this step?', submitter: "${approvers}"
echo "Proceeding with step..."
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1331 次 |
| 最近记录: |