[JIRA] (JENKINS-51962) Stage B is not skipped due to failure in stage A's nested stage

2 views
Skip to first unread message

thxmasj@gmail.com (JIRA)

unread,
Jun 15, 2018, 5:08:03 AM6/15/18
to jenkinsc...@googlegroups.com
Thomas Johansen created an issue
 
Jenkins / Bug JENKINS-51962
Stage B is not skipped due to failure in stage A's nested stage
Issue Type: Bug Bug
Assignee: Andrew Bayer
Components: pipeline-model-definition-plugin
Created: 2018-06-15 09:07
Priority: Critical Critical
Reporter: Thomas Johansen

After testing the new nested sequential stages feature in version 1.3 of pipeline-model-definition recently released, I found that the error handling is not working as (I) expected. Given this minimal Jenkinsfile

pipeline {
    agent none
    stages {
        stage('A') {
            stages {
                stage('A.1') {
                    steps {
                        error('Error in stage A.1')
                    }
                }
            }
        }
        stage('B') {
            steps {
                echo('Executing stage B')
            }
        }
    }
}

I expect that stage B is not executed, but it is, as the console output shows:

Branch indexing
 > git rev-parse --is-inside-work-tree # timeout=10
Setting origin to git@git:verification
 > git config remote.origin.url git@git:verification # timeout=10
Fetching origin...
Fetching upstream changes from origin
 > git --version # timeout=10
using GIT_SSH to set credentials 
 > git fetch --tags --progress origin +refs/heads/*:refs/remotes/origin/*
Seen branch in repository origin/master
Seen branch in repository origin/work/TEST-1234
Seen 2 remote branches
Obtained Jenkinsfile from fbd58047af16f0ab665ec6d550d21ceff1e91cfb
Running in Durability level: MAX_SURVIVABILITY
First time build. Skipping changelog.
[Pipeline] stage
[Pipeline] { (A)
[Pipeline] stage
[Pipeline] { (A.1)
[Pipeline] error
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (B)
[Pipeline] echo
Executing stage B
[Pipeline] }
[Pipeline] // stage
[Pipeline] End of Pipeline
Finished: FAILURE

Given a pipeline without nested stages the behaviour is as expected; stage B is skipped when stage A fails:

pipeline {
    agent none
    stages {
        stage('A') {
            steps {
                error('Error in stage A')
            }
        }
        stage('B') {
            steps {
                echo('Executing stage B')
            }
        }
    }
}

Console output shows that stage B is skipped:

Branch indexing
 > git rev-parse --is-inside-work-tree # timeout=10
Setting origin to git@git:verification
 > git config remote.origin.url git@git:verification # timeout=10
Fetching origin...
Fetching upstream changes from origin
 > git --version # timeout=10
using GIT_SSH to set credentials 
 > git fetch --tags --progress origin +refs/heads/*:refs/remotes/origin/*
Seen branch in repository origin/master
Seen branch in repository origin/work/TEST-1234
Seen 2 remote branches
Obtained Jenkinsfile from 203fe77650dbdd5392790cfe53558d7ef67fe0de
Running in Durability level: MAX_SURVIVABILITY
First time build. Skipping changelog.
[Pipeline] stage
[Pipeline] { (A)
[Pipeline] error
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (B)
Stage "B" skipped due to earlier failure(s)
[Pipeline] }
[Pipeline] // stage
[Pipeline] End of Pipeline
ERROR: Error in stage A
Finished: FAILURE
Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)
Atlassian logo

thxmasj@gmail.com (JIRA)

unread,
Jun 15, 2018, 8:01:01 AM6/15/18
to jenkinsc...@googlegroups.com

andrew.bayer@gmail.com (JIRA)

unread,
Jun 15, 2018, 10:30:02 AM6/15/18
to jenkinsc...@googlegroups.com
Andrew Bayer started work on Bug JENKINS-51962
 
Change By: Andrew Bayer
Status: Open In Progress

andrew.bayer@gmail.com (JIRA)

unread,
Jun 15, 2018, 10:30:02 AM6/15/18
to jenkinsc...@googlegroups.com

It's a definite bug - I've reproduced it and am working on it now.

andrew.bayer@gmail.com (JIRA)

unread,
Jun 15, 2018, 10:38:03 AM6/15/18
to jenkinsc...@googlegroups.com

andrew.bayer@gmail.com (JIRA)

unread,
Jun 15, 2018, 10:39:01 AM6/15/18
to jenkinsc...@googlegroups.com
 
Re: Stage B is not skipped due to failure in stage A's nested stage

Yup, that was a goofy mistake on my part - I wasn't propagating errors from nested sequential stages at all. Sigh - sorry about that. PR up at https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/271, this'll be in 1.3.1. I'm going to wait til late next week before releasing 1.3.1, though, since I'm betting there are going to be other little bugs like this that come up. Thanks for reporting this!

thxmasj@gmail.com (JIRA)

unread,
Jun 26, 2018, 2:02:01 PM6/26/18
to jenkinsc...@googlegroups.com

Andrew Bayer: Would it be ok to release 1.3.1 now?

This message was sent by Atlassian JIRA (v7.10.1#710002-sha1:6efc396)

andrew.bayer@gmail.com (JIRA)

unread,
Jun 26, 2018, 2:23:01 PM6/26/18
to jenkinsc...@googlegroups.com

Sorry, I got distracted - once JENKINS-52084 is ready, yes, I'll release 1.3.1

thxmasj@gmail.com (JIRA)

unread,
Jun 27, 2018, 9:49:02 AM6/27/18
to jenkinsc...@googlegroups.com

andrew.bayer@gmail.com (JIRA)

unread,
Jun 27, 2018, 10:49:02 AM6/27/18
to jenkinsc...@googlegroups.com
 

1.3.1 is releasing as we speak.

Change By: Andrew Bayer
Status: In Review Resolved
Resolution: Fixed

kabakv@gmail.com (JIRA)

unread,
Jun 28, 2018, 2:23:01 AM6/28/18
to jenkinsc...@googlegroups.com
Viachaslau Kabak updated an issue
Change By: Viachaslau Kabak
Attachment: image-2018-06-28-09-22-33-403.png

kabakv@gmail.com (JIRA)

unread,
Jun 28, 2018, 2:24:01 AM6/28/18
to jenkinsc...@googlegroups.com

bitwiseman@gmail.com (JIRA)

unread,
Oct 22, 2019, 11:24:43 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