【问题标题】:Configuration for multi-step parallel stages多步并行阶段的配置
【发布时间】:2018-05-10 18:39:28
【问题描述】:

我有一个包含多个服务的单一存储库。理想情况下,我想并行测试每个服务。每个分支有 2 个阶段:

  • 测试
  • 基准测试

给出类似的东西:

           clone
          /    \
         /      \
        /        \
       /          \
  svc1-test    svc2-test
      |            |
  svc1-bench   svc2-bench
      \            /
       \          /
        \        /
         \      /
          notify

只有在所有分支都成功的情况下,构建才会通过。此外,如果任何给定分支的测试失败,我们可能会提前使分支失败并且不执行基准测试。

通过阅读文档,我了解了如何使用 group 运行并行阶段,而不是如何将多个阶段放在一个分支中。

我想我的后备解决方案是将组合测试+基准放在一个阶段,但我认为隔离它们会很好,特别是因为每个阶段的依赖关系可能不同。

【问题讨论】:

  • 为什么不为test 设置一个组,为bench 设置一个组?测试将并行运行,如果任何测试失败,您将很快失败,然后运行基准测试。效果好像差不多。

标签: drone.io


【解决方案1】:

我正在寻找类似的东西,发现它由用户 cdieck 回答 here

This is how it looks in Blue Ocean.

复制相同的内容以供快速参考:

pipeline {
   agent none
   stages {
      stage("Example") {
         failFast true
         parallel {
            stage("win7-vs2012") {
               agent {
                  label "win7-vs2012"
               }
               stages {
                  stage("checkout (win7-vs2012)") {
                     steps {
                        echo "win7-vs2012 checkout"
                     }
                  } 

                  stage("build (win7-vs2012)") {
                     steps {
                        echo "win7-vs2012 build"
                     }
                  }

                  stage("test (win7-vs2012)") {
                     steps {
                        build 'test-win7-vs2012'
                     }
                  }
               } 
            }

            stage("win10-vs2015") {
               agent {
                  label "win10-vs2015"
               }
               stages {
                  stage("checkout (win10-vs2015)") {
                     steps {
                        echo "win10-vs2015 checkout"
                     }
                  } 

                  stage("build (win10-vs2015)") {
                     steps {
                        echo "win10-vs2015 build"
                     }
                  }

                  stage("test (win10-vs2015)") {
                     steps {
                        build 'test-win10-vs2015'
                     }
                  }
               } 
            }

            stage("linux-gcc5") {
               agent {
                  label "linux-gcc5"
               }
               stages {
                  stage("checkout (linux-gcc5)") {
                     steps {
                        echo "linux-gcc5 checkout"
                     }
                  } 

                  stage("build (linux-gcc5)") {
                     steps {
                        echo "linux-gcc5 build"
                     }
                  }

                  stage("test (linux-gcc5)") {
                     steps {
                        build 'test-linux-gcc5'
                     }
                  }
               } 
            }
         }
      }
   }
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-16
    • 2021-09-20
    • 1970-01-01
    • 1970-01-01
    • 2018-04-25
    • 2023-03-07
    相关资源
    最近更新 更多