Interrupting parallel stage with success status aborts the build with aborted status

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

XMLWordPrintable

      Hello,

      When running the following pipeline...

      pipeline {
          agent none
          stages {
              stage('Test') {
                  parallel {
                      stage('Fast stage') {
                          steps {
                              echo 'Done already'
                          }
                      }
                      stage('Slow stage') {
                          steps {
                              echo 'Please interrupt now!'
                              sleep 600
                          }
                      }
                  }
              }
          }
      }
      

      ... and interrupting the build programmatically with a success status while the "Slow stage" is still in progress, e.g. with the following snippet in Jenkins' script console...

      def build = Jenkins.instance.getItemByFullName('path/to/the/job').lastBuild
      def cause = new org.jenkinsci.plugins.pipeline.milestone.CancelledCause('testing')
      def executor = build.executor
      executor?.interrupt(hudson.model.Result.SUCCESS, cause)
      

      ... the build is aborted but its status is set to aborted instead of success.

      This behavior could be related to JENKINS-31953.

            Assignee:
            Unassigned
            Reporter:
            Alexis Gauthiez
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Archived: