Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Introduction

One of the key goals of Continuous Integration is to support a shift left testing philosophy which provides Developers with fast feedback on the quality of their code changes. This is achieved, in part, by the use of fast, tightly-scoped tests, triggered quickly after a change is detected. As such, the speed of the Continuous Integration testing process is of paramount importance. This speed can be optimised using a number of methods, the most effective of which are…

...

This page describes how to configure the latter in Jenkins.

MettleCI Use Cases

In MettleCI the obvious candidates for parallel test execution are:

...

Each of these can be performed concurrently without affecting the other as the Compliance processes run independently in memory using a data from supplied files, while the Unit Test runs in the DataStage environment as one or more executing Jobs.

Parallelism in Jenkins

At which pipeline level? Stages, which (remember) can be nested.

Our use cases: Compliance (WARN), Compliance (FAIL), and Unit Test steps (term?) concurrently.Parallelism in Jenkins is defined at the Stage level which means that a single Jenkins Pipeline is invoked, containing…

  • Some Stages configured to run sequentially (with their component Steps running sequentially), and/or

  • Some Stages configured to run concurrently (with their component Steps running sequentially)

See Parallel stages with Declarative Pipeline 1.2 (jenkins.io)

Defining Parallel Stages in a Jenkins Pipeline

Here’s a pseudocode representation of two parallel Stages defined in a Jenkins Pipeline. It runs the following stages concurrently:

  • A test (Windows command line) on any Jenkins Agent with a ‘windows’ label, and

  • A test (Unix shell) on any Jenkins Agent with a ‘linux’ label

Code Block
pipeline {
    stages {
        stage('Do These Concurrently') {
            parallel {
                stage('Test On Windows') {
                    agent {
                        label "windows"
                    }
                    steps {
                        bat "run-tests.bat"
                    }
                    post {
                        always {
                            junit "**/TEST-*.xml"
                        }
                    }
                }
                stage('Test On Linux') {
                    agent {
                        label "linux"
                    }
                    steps {
                        sh "run-tests.sh"
                    }
                    post {
                        always {
                            junit "**/TEST-*.xml"
                        }
                    }
                }
            }
        }
    }
}

...