代码之家  ›  专栏  ›  技术社区  ›  David Williams

可以在Jenkins声明性管道中按分支设置代理吗

  •  3
  • David Williams  · 技术社区  · 8 年前

    我认为答案是否定的,但声明性Jenkins管道是否可以基于git分支设置代理。您似乎无法使用 什么时候

    1 回复  |  直到 8 年前
        1
  •  5
  •   Vitalii Vitrenko    8 年前

    您可以编写常规groovy if {} else {} 之前的声明 pipeline {} .差不多吧

    def agentLabel
    if (BRANCH_NAME == "foo") {
        agentLabel = "fooAgent"
    } else {
        agentLabel = "barAgent"
    }
    
    pipeline {
        agent { label agentLabel }
        //...
    }