【问题标题】:Jenkins: aggregating matrix build resultsJenkins:聚合矩阵构建结果
【发布时间】:2021-10-11 17:25:31
【问题描述】:

我使用 Jenkins 矩阵并行运行一堆测试。有一个文件是测试的结果。完成所有测试后,我想将所有生成的文件放在一个构建代理上的一个工作区中并进行一些分析。

pipeline {
    agent none
    stages {
        stage('TestEm') {
            matrix {
                agent any
                axes {
                    axis {
                        name 'i'
                        values '1','2','3','4'
                    }
                }
                stages {
                    stage('Test') {
                        steps {
                            echo "Do Test for $i"
                            sh """
                               sleep 10
                               echo Test for $i > ${i}.txt
                            """
                        }
                    }
                }
            }
        }
        stage("Aggregate results") {
            agent any
            steps {
               // do the magic and get 1.txt .. 4.txt here, in this workspace
            }
        }
    }
}

但我不知道如何施展魔法并在最后一步收集矩阵的所有结果。

【问题讨论】:

    标签: jenkins matrix aggregate


    【解决方案1】:

    使用内置的stash/unstash 进行操作。只需将stash includes: '*.txt', name: "$i" 放在测试阶段,将unstash '1' 放在聚合阶段即可。

    【讨论】:

      猜你喜欢
      • 2020-10-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多