Continue Jenkins pipeline past failed stage

I have a series of stages that perform quick checks. I want to perform them all, even if there are failures. For example:

stage('one') {
    node {
        sh 'exit 0'
    }
}
stage('two') {
    node {
        sh 'exit 1'   // failure
    }
}
stage('three') {
    node {
        sh 'exit 0'
    }
}

Stage two fails, so by default stage three is not executed.

  • Git - What is “Refspec”
  • How do we manually fix “ResourceRules.plist: cannot read resources” error after xcode 6.1 upgrade?
  • Jenkins build fails because can't clone git repo
  • git install on jenkins slaves
  • console output from the jenkins shows timeout and errors
  • How to avoid checkout of sources on master node with jenkins pipeline
  • Ordinarily this would be a job for parallel, but I want to display them in the stage view. In the mock up below:

    • Build #4 shows what normally happens. Job two fails so three does not run.
    • I Photoshopped Build #6 to show what I would like to see. Job two fails and is displayed as such, but three still runs. The real Jenkins would probably display the entire Build #6 in red, which is of course fine.

    Mock up of desired Stage View result

  • Groovy .each only iterates one time
  • Respoinse Assertions in JMeter with Jenkins - never showing a failure
  • Jenkins cannot read Github password since upgrading to Git client plugin 2.1.0
  • Jenkins Pipeline NotSerializableException: groovy.json.internal.LazyMap
  • Jenkins How can i upload a text file and use it as a parameter
  • Reduce log level in Sonar 2.1.x
  • One Solution collect form web for “Continue Jenkins pipeline past failed stage”

    This should work. However all boxes are red if even only one fails, but you can see boxes with error marked, so you will easily distinguish failed jobs.

    def indexes = ['one', 'two', 'three']
    
    node() {
        for (index in indexes) {
            catchError {
                stage(index) {
                    println index
                    sh '''echo "123"'''
                }
            }
        }
    }
    
    Git Baby is a git and github fan, let's start git clone.