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

Matrix with failFast: false triggers post failure in success stages

      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

       

          [JENKINS-65997] Matrix with failFast: false triggers post failure in success stages

          Victor Martinez created issue -
          Victor Martinez made changes -
          Attachment New: screenshot-1.png [ 55067 ]
          Victor Martinez made changes -
          Attachment New: screenshot-2.png [ 55068 ]
          Victor Martinez made changes -
          Description Original: Hi there,

           

          I've just started to see an unexpected behaviour when using 

           

           
          {code:java}
          //

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

          {code}
           
          New: 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:

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


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

           !screenshot-1.png|thumbnail!

          The `selected terraform stage` runs the below snippet


          {code:java}
                    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()
                        }
                      }
                    }
          {code}

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

           !screenshot-2.png|thumbnail!

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

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

          * https://github.com/elastic/azure-vm-extension/pull/22
          * https://beats-ci.elastic.co/blue/organizations/jenkins/Beats%2Fazure-vm-extension-mbp%2FPR-22/detail/PR-22/3/pipeline/


          Existing configuration:

          * Jenkins core: 2.189.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




           
          Victor Martinez made changes -
          Description Original: 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:

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


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

           !screenshot-1.png|thumbnail!

          The `selected terraform stage` runs the below snippet


          {code:java}
                    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()
                        }
                      }
                    }
          {code}

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

           !screenshot-2.png|thumbnail!

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

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

          * https://github.com/elastic/azure-vm-extension/pull/22
          * https://beats-ci.elastic.co/blue/organizations/jenkins/Beats%2Fazure-vm-extension-mbp%2FPR-22/detail/PR-22/3/pipeline/


          Existing configuration:

          * Jenkins core: 2.189.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




           
          New: 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:

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


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

           !screenshot-1.png|thumbnail!

          The `selected terraform stage` runs the below snippet


          {code:java}
                    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()
                        }
                      }
                    }
          {code}

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

           !screenshot-2.png|thumbnail!

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

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

          * https://github.com/elastic/azure-vm-extension/pull/22
          * https://beats-ci.elastic.co/blue/organizations/jenkins/Beats%2Fazure-vm-extension-mbp%2FPR-22/detail/PR-22/3/pipeline/


          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




           

            Unassigned Unassigned
            v2v Victor Martinez
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: