[JIRA] (JENKINS-60569) Declarative Post Stage block not Working as exepected in parallel stages

8 views
Skip to first unread message

kmurthy.ms@gmail.com (JIRA)

unread,
Dec 22, 2019, 1:01:04 PM12/22/19
to jenkinsc...@googlegroups.com
krishnamurthy ms created an issue
 
Jenkins / Bug JENKINS-60569
Declarative Post Stage block not Working as exepected in parallel stages
Issue Type: Bug Bug
Assignee: Unassigned
Components: _unsorted
Created: 2019-12-22 18:00
Priority: Major Major
Reporter: krishnamurthy ms

In parallel stages .. when each individual stages have post block . the failure block execution is not working as expected

Sample pipeline script

pipeline {
{{ agent any}}
{{ stages{}}
{{ stage("initvar"){}}
{{ steps{}}
{{ script{}}
{{ sh " echo initvars"}}
{{ }}}
{{ }}}
{{ }}}
{{ stage('Parallel Stage1'){}}
{{ parallel {}}
{{ stage("Stage1.1"){}}
{{ steps{}}
{{ script{}}
{{ catchError(message: "stage1.1 failed ", stageResult: 'FAILURE'){}}
{{ sh """}}
{{ echo pass}}
{{ """}}
{{ }}}
{{ }}}
{{ }}}
{{ post{}}
{{ failure{}}
{{ echo "from stage 1.1"}}
{{ }}}
{{ }}}
{{ }}}stage("Stage1.2"){
{{ steps{}}
{{ script{}}
{{ catchError(message: "stage1.2 failed", stageResult: 'FAILURE'){}}
{{ sh """}}
{{ echo fail}}
{{ exit 1}}
{{ """}}
{{ }}}
{{ }}}
{{ }}}
{{ post{}}
{{ failure{}}
{{ echo "from stage 1.2"}}
{{ }}}
{{ }}}
{{ }}}
{{ }}}
{{ }}}

{{ stage("Parallel Stage 2"){}}
{{ parallel{}}
{{ stage("Stage2.1"){}}
{{ steps{}}
{{ script{}}
{{ catchError( message: "stage1.2 failed", stageResult: 'FAILURE'){}}

{{ sh """}}
{{ echo "new pass"}}
{{ """}}

{{ }}}
{{ }}}
{{ }}}
{{ post{}}
{{ failure{}}
{{ script{}}
{{ echo "from stage 2.1"}}
{{ }}}
{{ }}}
{{ }}}
{{ }}}
{{ stage("Stage 2.2"){}}
{{ steps{}}
{{ script{}}
{{ catchError( message: "stage2.2 failed", stageResult: 'FAILURE'){}}
{{ sh """}}
{{ exit 1}}
{{ """}}
{{ }}}
{{ }}}
{{ }}}
{{ post{}}
{{ failure{}}
{{ script{}}
{{ echo "from stage 2.1"}}
{{ }}}
{{ }}}
{{ }}}
{{ }}}

{{ }}}
{{ }}}

{{ }}}
{{ post{}}
{{ always{}}
{{ sh "echo always" }}
{{ }}}
{{ success{}}
{{ script{}}
{{ sh "echo success"}}
{{ }}}
{{ }}}
{{ failure{}}
{{ script{}}
{{ sh "echo failure"}}
{{ }}}
{{ }}}
{{ }}}
}

 

{{Here post failure block of stage 1.1 and 2.1 should not have been executed }}

 

Jenkins version 2.190.2

Pipeline groovy 2.78

Pipeline: Basic Steps : 2.18

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

kmurthy.ms@gmail.com (JIRA)

unread,
Dec 22, 2019, 1:02:03 PM12/22/19
to jenkinsc...@googlegroups.com
krishnamurthy ms updated an issue
Change By: krishnamurthy ms
In parallel stages .. when each individual stages have post block . the failure block execution is not working as expected

Sample pipeline script

{{
pipeline { { }} }}

 
{ code:java}
pipeline
{

{
{ code } }}

 

{{
Here post failure block of stage 1.1 and 2.1 should not have been executed }}

 

{{Jenkins version 2.190.2}}

{{Pipeline groovy 2.78}}

kmurthy.ms@gmail.com (JIRA)

unread,
Dec 22, 2019, 1:02:03 PM12/22/19
to jenkinsc...@googlegroups.com
krishnamurthy ms updated an issue
In parallel stages .. when each individual stages have post block . the failure block execution is not working as expected

Sample pipeline script :

{ {{{}}}}

 
{
code:java}

kmurthy.ms@gmail.com (JIRA)

unread,
Dec 22, 2019, 1:48:03 PM12/22/19
to jenkinsc...@googlegroups.com
                     echo "from stage 2. 1 2 "

                     }
                     }
                    }
                }
                
            }
        }
        
    }
    post{
        always{
            sh "echo always"  
        }
        success{
            script{
                sh "echo success"
            }
        }
        failure{
            script{
                sh "echo failure"
            }
        }
    }
}
{code}
Here post failure block of stage 1.1 and 2.1 should not have been executed

 

{{Jenkins version 2.190.2}}

{{Pipeline groovy 2.78}}

{{[Pipeline: Basic Steps|https://wiki.jenkins-ci.org/display/JENKINS/Pipeline+Basic+Steps+Plugin] : 2.18}}
Reply all
Reply to author
Forward
0 new messages