[JIRA] (JENKINS-60239) Aborted catchError sets build result to ABORTED if fail fast is true

24 views
Skip to first unread message

dpuiu@luxoft.com (JIRA)

unread,
Nov 21, 2019, 5:57:03 AM11/21/19
to jenkinsc...@googlegroups.com
Daniel Puiu created an issue
 
Jenkins / Bug JENKINS-60239
Aborted catchError sets build result to ABORTED if fail fast is true
Issue Type: Bug Bug
Assignee: Andrew Bayer
Components: pipeline-model-definition-plugin
Created: 2019-11-21 10:56
Environment: Jenkins: 2.164.3
Pipeline: Basic Steps: 2.16
Labels: pipeline
Priority: Critical Critical
Reporter: Daniel Puiu

If I have a stage with a step in it:

                         ...
                         catchError(buildResult: hudson.model.Result.SUCCESS,
                                   message: 'RPM build failed, but allowing job to continue',
                                   stageResult: hudson.model.Result.FAILURE) {
                            sh label: env.STAGE_NAME,
                               script: 'exit 2'
                        }

With a post block for the stage:

                    post {
                        always {
                            archiveArtifacts artifacts: 'artifacts/**'
                        }
                        success {
                            println "${env.STAGE_NAME}: SUCCESS"
                        }
                        unstable {
                            println "${env.STAGE_NAME}: UNSTABLE"
                        }
                        failure {
                            println "${env.STAGE_NAME}: FAILED"
                        }
                    }

 I actually get the:

My Test Stage: SUCCESS

telling me that the stage was a SUCCESS, not a FAILURE like the:

catchError(..., stageResult: hudson.model.Result.FAILURE) is supposed to be making it.

In both the stage view and the Blue Ocean view, it does show as a failed stage. The post processing block just doesn't see it that way.

As an aside, is there a variable set for the stage that I could use in my println above so that I could just do a single println in the always block rather than having to repeat it through the success, unstable and failure blocks?

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo

dpuiu@luxoft.com (JIRA)

unread,
Nov 21, 2019, 5:58:02 AM11/21/19
to jenkinsc...@googlegroups.com
Daniel Puiu assigned an issue to Unassigned
Change By: Daniel Puiu
Assignee: Andrew Bayer

dpuiu@luxoft.com (JIRA)

unread,
Nov 21, 2019, 5:58:03 AM11/21/19
to jenkinsc...@googlegroups.com
Daniel Puiu updated an issue
If I have a stage with a step in it:
{noformat}

                      ...
                      catchError(buildResult: hudson.model.Result.SUCCESS,
                     message: 'RPM build failed, but allowing job to continue',
                     stageResult: hudson.model.Result.FAILURE) {
                     sh label: env.STAGE_NAME,
                     script: 'exit 2'
                     }
{noformat}

With a {{post}} block for the stage:
{noformat}

                    post {
                     always {
                     archiveArtifacts artifacts: 'artifacts/**'
                     }
                     success {
                     println "${env.STAGE_NAME}: SUCCESS"
                     }
                     unstable {
                     println "${env.STAGE_NAME}: UNSTABLE"
                     }
                     failure {
                     println "${env.STAGE_NAME}: FAILED"
                     }
                    }
{noformat}
 I actually get the:
{noformat}
My Test Stage: SUCCESS
{noformat}

telling me that the stage was a SUCCESS, not a FAILURE like the:

{{catchError(..., stageResult: hudson.model.Result.FAILURE)}} is supposed to be making it.

In both the stage view and the Blue Ocean view, it does show as a failed stage. The {{post}} processing block just doesn't see it that way.

As an aside, is there a variable set for the stage that I could use in my {{println}} above so that I could just do a single {{println}} in the {{always}} block rather than having to repeat it through the {{success}}, {{unstable}} and {{failure}} blocks?

dpuiu@luxoft.com (JIRA)

unread,
Nov 21, 2019, 5:58:03 AM11/21/19
to jenkinsc...@googlegroups.com
Daniel Puiu updated an issue
Change By: Daniel Puiu
Environment: Jenkins: 2. 164.3 198
Pipeline: Basic Steps: 2.16

dpuiu@luxoft.com (JIRA)

unread,
Nov 21, 2019, 6:00:02 AM11/21/19
to jenkinsc...@googlegroups.com
Daniel Puiu updated an issue
Change By: Daniel Puiu
Environment: Jenkins: 2.198
Pipeline: Basic Steps: 2.16

dpuiu@luxoft.com (JIRA)

unread,
Nov 21, 2019, 6:06:05 AM11/21/19
to jenkinsc...@googlegroups.com
Daniel Puiu updated an issue
Hello, 

I have the following declarative pipeline:

 
{code:java}
pipeline {

    agent any

    options {
        parallelsAlwaysFailFast()
    }
     
    stages {
        stage('A') {
            parallel {
                stage('A1') {
                    steps {
                     error 'fail'
                    }
                }
                
                stage('A2') {
                    steps {
                     script {
                     catchError(stageResult: 'FAILURE') {
                     println 'a2'
                     sleep 10
                     }
                     }
                    }
                }
            }
        }
    }
}
{code}

The result is ABORTED instead of FAILURE.

dpuiu@luxoft.com (JIRA)

unread,
Nov 21, 2019, 6:06:06 AM11/21/19
to jenkinsc...@googlegroups.com

dpuiu@luxoft.com (JIRA)

unread,
Nov 21, 2019, 6:07:05 AM11/21/19
to jenkinsc...@googlegroups.com

I think that somehow aborting a stage that contains a `catchError` affects the build result.

dpuiu@luxoft.com (JIRA)

unread,
Nov 21, 2019, 6:08:02 AM11/21/19
to jenkinsc...@googlegroups.com
I think that somehow aborting a stage that contains a `catchError` _catchError_ affects the build result.

For me the expected result is FAILURE

dpuiu@luxoft.com (JIRA)

unread,
Dec 11, 2019, 3:58:02 AM12/11/19
to jenkinsc...@googlegroups.com

dnusbaum@cloudbees.com (JIRA)

unread,
Mar 10, 2020, 5:17:03 PM3/10/20
to jenkinsc...@googlegroups.com
Devin Nusbaum updated an issue
Change By: Devin Nusbaum
Component/s: workflow-basic-steps-plugin
Component/s: pipeline-model-definition-plugin
This message was sent by Atlassian Jira (v7.13.12#713012-sha1:6e07c38)
Atlassian logo

dnusbaum@cloudbees.com (JIRA)

unread,
Mar 10, 2020, 5:18:03 PM3/10/20
to jenkinsc...@googlegroups.com
Devin Nusbaum commented on Bug JENKINS-60239
 
Re: Aborted catchError sets build result to ABORTED if fail fast is true

Did you try using catchError(catchInterruptions: false)?

dpuiu@luxoft.com (JIRA)

unread,
Mar 13, 2020, 6:41:03 AM3/13/20
to jenkinsc...@googlegroups.com

Hello Devin Nusbaum,
I have tried it following your suggestion and it works.
Thanks
Best regards

dpuiu@luxoft.com (JIRA)

unread,
Mar 13, 2020, 6:43:02 AM3/13/20
to jenkinsc...@googlegroups.com
Daniel Puiu closed an issue as Not A Defect
 
Change By: Daniel Puiu
Status: Open Closed
Resolution: Not A Defect

dnusbaum@cloudbees.com (JIRA)

unread,
Mar 13, 2020, 9:54:03 AM3/13/20
to jenkinsc...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages