我认为答案是否定的,但是声明式 Jenkins 管道是否可以基于 git 分支设置代理。您似乎无法使用when块。
您可以if {} else {}在 之前编写常规的 groovy 语句pipeline {}。类似的东西
def agentLabel
if (BRANCH_NAME == "foo") {
agentLabel = "fooAgent"
} else {
agentLabel = "barAgent"
}
pipeline {
agent { label agentLabel }
//...
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2606 次 |
| 最近记录: |