Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-40699

Post-stage/build test results etc doesn't play well with parallel on multiple nodes

XMLWordPrintable

      If I want to run five different test suites, each having their own test result patterns, on five different nodes, in parallel, how do I do that?

      The abbreviated pipeline below all seems to work except for the collecting test results part, since when tests fail, the junit instruction is ignored (I guess since the previous step had a non-zero exit code).

      When not using the new declarative pipeline format, I could potentially use try/catch/finally and shove the junit instruction in the finally block as seen here.

      Current attempt:

      pipeline {
        agent label:'master'
        environment {
          GIT_COMMITTER_NAME = "jenkins"
          GIT_COMMITTER_EMAIL = "jenkins@jenkins.io"
        }
        stages {
          stage("Build") {
            steps {
              parallel (
                "sweet" : {
                  node("has-docker") {
                    git 'ssh://git@stash.example.com/automation/sweet.git'
                    sh 'APP_NAME=sweet \
                      TEST_ENV=qa5 \
                      bin/ci'
                    junit '**/test-reports/*.xml'
                  }
                },
                "word" : {
                  node("has-docker") {
                    git 'ssh://git@stash.example.com/automation/word.git'
                    sh 'APP_NAME=word \
                      TEST_ENV=qa5 \
                      bin/ci'
                    junit '**/nosetests.xml'
                  }
                }
              )
            }
          }
        }
        post {
          always {
            deleteDir()
          }
        }
      }
      

      So in summary, the existing docs on parallel execution are pretty good, but they don't describe how to collect test results from parallel executions on different nodes.

            abayer Andrew Bayer
            kburnett Kevin Burnett
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: