0

I have a mono-repo that contains multiple services. Ideally, I want to test each service in parallel. Each branch has 2 stages:

  • test
  • benchmark

To give something similar to this:

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

The build would pass only if the all branches have succeeded. Furthermore, we could fail a branch early and not execute the benchmarking if the tests fail for any given branch.

From reading the documentation I see how I can run parallel stages using group, but not how to put many stages in a single branch.

I guess my fallback solution would be to put combine test+benchmark in a single stage, but I think it would be nice to isolate them, especially since the dependencies may vary for each.

QuantumLicht
  • 2,103
  • 3
  • 23
  • 32
  • 1
    Why not having a group for `test` and a group for `bench`? tests will run in parallel, and you will fail fast if any test fails, then run the benchmarks. The effect seems to be almost the same. – ronhash May 13 '18 at 09:15

1 Answers1

0

I was looking for something similar and found it answered here by the user cdieck.

This is how it looks in Blue Ocean.

Copying the same for quick reference:

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'
                     }
                  }
               } 
            }
         }
      }
   }
}
Dibakar Aditya
  • 3,893
  • 1
  • 14
  • 25