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

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • workflow-cps-plugin
    • None

      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.

            Unassigned Unassigned
            agauthiez Alexis Gauthiez
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: