Hi,

I've been trying to fix a bug in the scmSkip plugin where pipeline job is 
marked as aborted, but does not actually stop. I found 4 ways to stop a 
WorkflowRun
* calling interrupt on either executor (getExecutor or getOneOffExecutor) 
-- effectively what the plugin does right now, it does not stop the 
pipeline though
* calling doKill -- kills the job *too* well, even the "post {always}" part 
is skipped
* throwing AbortException -- stops the job and executes "post {always}", 
but job is FAILED rather than ABORTED

The following pipeline illustrates the problem:

pipeline {
    agent any

    stages {
        stage('Hello') {
            steps {
                script {
                echo "this should be printed"
                // calling interrupt directly, should be done by plugin
                
currentBuild.rawBuild.getOneOffExecutor().interrupt(Result.ABORTED)
                
currentBuild.rawBuild.getExecutor().interrupt(Result.ABORTED)
                echo "this should be skipped"
                }
            }
        }
    }
    
    post {
        always {
            echo "this should be printed again"
        }
    }
}

Somehow "this should be skipped" is always printed (at least in environment 
with SSH agents).

What is the correct way to abort pipeline programmatically?

Thanks,
Zbynek

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/928e3325-2dc1-4fce-94a8-210e7cd6a9f1n%40googlegroups.com.

Reply via email to