Matrix with failFast: false triggers post failure in success stages

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      Hi there,

      I've just started to see an unexpected behaviour when usingĀ failFast: false, since the post-failure nested stage in the matrix gets executed for the stages that did run successfully.

      To illustrate the above, I use the above snippet:

      stage(..) {
          options { skipDefaultCheckout() }
          failFast false
          matrix {
              agent { .. }
              axes {
                  axis { .. }
              }
              stages {
                  stage(..){
                      steps { .. }
                      post {
                          failure { .. }
                      }
                  }
              }
          }
      }
      

      What do I see? for instance, given the below screenshot

      The `selected terraform stage` runs the below snippet

                stage('Terraform') {
                  options { skipDefaultCheckout() }
                  steps {
                    withGithubNotify(context: "Terraform ${ELASTIC_STACK_VERSION} ${OS_VERSION}") {
                      withCloudEnv() {
                        withAzEnv() {
                          sh(label: 'Run terraform plan', script: 'make -C .ci terraform-run')
                        }
                      }
                    }
                    echo "DEBUG status in stage - ${currentBuild.getCurrentResult()}"
                  }
                  post {
                    always {
                      echo "DEBUG status in post-always-stage - ${currentBuild.getCurrentResult()}"
                    }
                    failure {
                      echo "DEBUG status in post-failure-stage - ${currentBuild.getCurrentResult()}"
                      destroyTerraform()
                      destroyCluster()
                    }
                  }
                }
      

      And somehow, the `terraform` stage is able to execute the last step `echo "DEBUG status in stage - ${currentBuild.getCurrentResult()}"`

      While, the stage itself didn't fail at all :/

      If you need further details, the existing pipeline runs in a public accessible jenkins controller:

      Existing configuration:

      • Jenkins core: 2.289.1
      • Jenkins plugins: Declarative model -> 1.8.5 (the remaining list of plugins can be found in https://beats-ci.elastic.co/pluginusage/)
      • If you need the OS and JDK version please let me know, I will not add those details here for the time being to avoid any security stuff

      Ā 

        1. screenshot-1.png
          467 kB
          Victor Martinez
        2. screenshot-2.png
          99 kB
          Victor Martinez

            Assignee:
            Unassigned
            Reporter:
            Victor Martinez
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Archived: