[JIRA] (JENKINS-38049) FlowExecution.getResult() and FlowExecution.getCauseOfFailure() regression with Pipeline script

16 views
Skip to first unread message

vivek.pandey@gmail.com (JIRA)

unread,
Sep 7, 2016, 11:01:03 PM9/7/16
to jenkinsc...@googlegroups.com
Vivek Pandey created an issue
 
Jenkins / Bug JENKINS-38049
FlowExecution.getResult() and FlowExecution.getCauseOfFailure() regression with Pipeline script
Issue Type: Bug Bug
Assignee: Andrew Bayer
Components: pipeline-model-definition-plugin
Created: 2016/Sep/08 3:00 AM
Priority: Major Major
Reporter: Vivek Pandey

Given pipeline script:

pipeline {
    agent label:''
    stages {
        stage ('Build') {
            sh 'echo1 "Building"'
        }
    }
}

WorkflowRun.getExecution().getResult() reports Success also WorkflowRun.getExecution().getCauseOfFaulure() returns null.

This is regression when compared with non-kyoto style pipeline.

 
                                                            

node {
stage ('Build')

{ sh 'echo1 "Building"' }

}

Above script gives WorkflowRun.getExecution().getResult() as FAILURE and WorkflowRun.getExecution().getCauseOfFaulure() as non null Throwable.

What it does is that when we are dealing with FlowNodes and trying to determine if stage failed, does not work in this case and ends up reporting SUCCESS of overall run where its in fact was a failure. run.getResult() gives correct value as FAILURE.

Andrew Bayer This is the issue I mentioned you over chat.

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)
Atlassian logo

vivek.pandey@gmail.com (JIRA)

unread,
Sep 7, 2016, 11:01:04 PM9/7/16
to jenkinsc...@googlegroups.com
Vivek Pandey updated an issue
Change By: Vivek Pandey
Given pipeline script:

{code:java}

pipeline {
    agent label:''
    stages {
        stage ('Build') {
            sh 'echo1 "Building"'
        }
    }
}
{code}


WorkflowRun.getExecution().getResult() reports Success also WorkflowRun.getExecution().getCauseOfFaulure() returns null.

This is regression when compared with non-kyoto style pipeline.

{code:java}

node {
    stage ('Build') {
        sh 'echo1 "Building"'
    }
}
{code}
Above script gives WorkflowRun.getExecution().getResult() as FAILURE and WorkflowRun.getExecution().getCauseOfFaulure() as non null Throwable.

What it does is that when we are dealing with FlowNodes and trying to determine if stage failed, does not work in this case and ends up reporting SUCCESS of overall run where its in fact was a failure. run.getResult() gives correct value as FAILURE.

[~abayer] This is the issue I mentioned you over chat.

vivek.pandey@gmail.com (JIRA)

unread,
Sep 7, 2016, 11:02:02 PM9/7/16
to jenkinsc...@googlegroups.com
Vivek Pandey updated an issue
Given pipeline script:

{code:java}
pipeline {
    agent label:''
    stages {
        stage ('Build') {
            sh 'echo1 "Building"'
        }
    }
}
{code}

WorkflowRun.getExecution().getResult() reports Success also WorkflowRun.getExecution().getCauseOfFaulure() returns null.

This is regression when compared with non-kyoto style pipeline.

{code:java}
node {
    stage ('Build') {
        sh 'echo1 "Building"'
    }
}
{code}
Above script gives works correctly where WorkflowRun.getExecution().getResult() as FAILURE and WorkflowRun.getExecution().getCauseOfFaulure() as non null Throwable.


What it does is that when we are dealing with FlowNodes and trying to determine if stage failed, does not work in this case and ends up reporting SUCCESS of overall run where its in fact was a failure. run.getResult() gives correct value as FAILURE.

[~abayer] This is the issue I mentioned you over chat.

Andrew Bayer

unread,
Sep 7, 2016, 11:13:06 PM9/7/16
to jenkinsc...@googlegroups.com

Interesting. I'll see what I can figure out.

andrew.bayer@gmail.com (JIRA)

unread,
Sep 8, 2016, 11:40:01 AM9/8/16
to jenkinsc...@googlegroups.com
Andrew Bayer commented on Bug JENKINS-38049
 
Re: FlowExecution.getResult() and FlowExecution.getCauseOfFailure() regression with Pipeline script

So I'm not entirely clear on what's happening - we're using catchError extensively, so I assume that's swallowing failures? Sam Van Oort, Jesse Glick - do you have any ideas on this?

andrew.bayer@gmail.com (JIRA)

unread,
Sep 8, 2016, 12:03:03 PM9/8/16
to jenkinsc...@googlegroups.com
Andrew Bayer started work on Bug JENKINS-38049
 
Change By: Andrew Bayer
Status: Open In Progress

andrew.bayer@gmail.com (JIRA)

unread,
Sep 8, 2016, 12:04:02 PM9/8/16
to jenkinsc...@googlegroups.com

andrew.bayer@gmail.com (JIRA)

unread,
Sep 8, 2016, 12:05:02 PM9/8/16
to jenkinsc...@googlegroups.com
 
Re: FlowExecution.getResult() and FlowExecution.getCauseOfFailure() regression with Pipeline script

PR up - https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/10 - switched from catchError to judicious use of try/catch and rethrowing at the end. I think this does the trick.

scm_issue_link@java.net (JIRA)

unread,
Sep 8, 2016, 12:46:02 PM9/8/16
to jenkinsc...@googlegroups.com

Code changed in jenkins
User: Andrew Bayer
Path:
src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy
src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/BasicModelDefTest.java
src/test/resources/failingNotifications.groovy
src/test/resources/failingPipeline.groovy
src/test/resources/failingPostBuild.groovy
http://jenkins-ci.org/commit/pipeline-model-definition-plugin/60d216b277025ab684a86b12cdd4ce234e466b04
Log:
[FIXED JENKINS-38049] Stop using catchError.

And make sure we throw failures properly. This still feels a bit weird
to me, but it's on the right track, at least.

andrew.bayer@gmail.com (JIRA)

unread,
Sep 8, 2016, 1:23:02 PM9/8/16
to jenkinsc...@googlegroups.com

bitwiseman@gmail.com (JIRA)

unread,
Oct 22, 2019, 11:25:00 PM10/22/19
to jenkinsc...@googlegroups.com
Liam Newman closed an issue as Fixed
 

Bulk closing resolved issues.

Change By: Liam Newman
Status: Resolved Closed
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages