【问题标题】:Jenkins 'agent: none' lightweight executor equivalent with scripted pipelineJenkins 'agent: none' 轻量级执行器等效于脚本化管道
【发布时间】:2018-06-29 16:20:17
【问题描述】:

使用 Jenkins 声明式语法,可以在没有顶级代理的情况下运行并行阶段。这最终会消耗两个执行程序,因为顶级代理被标记为“无”:

pipeline {
    agent none
    stages {
        stage('Run on parallel nodes') {
            parallel {
                stage('Do one thing') {
                    agent any
                    steps {
                        ...
                    }
                stage('Do another thing') {
                    agent any
                    steps {
                        ...
                    }
                }
            }
        }
    }
}

对于需要顶级“节点”元素的脚本化管道,这似乎是不可能的。这最终会消耗三个 executor,尽管只有两个在做实际工作:

node {
  stage('Run on parallel nodes') {
    parallel ([
      'Do one thing': {
          node() {
            ...
          }
      },
      'Do another thing': {
          node() {
              ...
          }
      }
    ])
  }
}

脚本化管道是否可以实现“轻量级”顶级执行器?

【问题讨论】:

    标签: jenkins jenkins-pipeline jenkins-declarative-pipeline


    【解决方案1】:

    脚本化管道不需要顶级 node 分配。这是错误的,可以省略。

    【讨论】:

    • 好电话,我不知道为什么我认为需要顶级节点分配,谢谢!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-01-04
    • 2021-12-14
    • 1970-01-01
    • 2021-12-17
    • 2021-10-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多