[JIRA] (JENKINS-54378) Pipeline templates in parallel blocks are interpreted as being "nested"

1 view
Skip to first unread message

fnasser@redhat.com (JIRA)

unread,
Oct 31, 2018, 5:11:02 PM10/31/18
to jenkinsc...@googlegroups.com
Fernando Nasser created an issue
 
Jenkins / Bug JENKINS-54378
Pipeline templates in parallel blocks are interpreted as being "nested"
Issue Type: Bug Bug
Assignee: Andrew Bayer
Components: pipeline-model-definition-plugin
Created: 2018-10-31 21:10
Priority: Major Major
Reporter: Fernando Nasser

I understood that having nested pipeline {} blocks was  not possible.

However I found out now that one cannot run pipeline {} blocks in parallel.

The reason I considered this as a Bug is that these pipeline {} blocks are not "nested" (at least visibly) which is what the documentation says it is not allowed.  So this should be allowed accordingly to the documentation.

I marked it as Major as it takes away possibly the major use case of "pipeline templates".

A common sequence of stages that achieves some X result is made into a "pipeline template" for avoiding repeating code (DNRY) and so it can be used with different parameters many times.  But having to do this many times SEQUENTIALLY is most of the times impractical as it would make the pipeline execution be too long.

The only workaround would be to repeat the sequence of stages in each parallel block so not using the "pipeline template".

Example:  I get a 
java.lang.IllegalStateException: Only one pipeline { ... } block can be executed in a single run.
when trying to invoke it on one of the parallel blocks:

(the ettPipeline is a declarative "pipeline template"; only one of it runs perfectly to completion)

    try {

        stage('Parallel Builds') {

            parallel (

                Build1: { node {

                    ettPipeline (

                        task: "${ETT_TASK}",

                        pkg: "${ETT_PACKAGE}",

                        scm_url: "${SCM_URL}",

                        clentry: "${NOTE}",

                        email: "${EMAIL}"

                    )

                }},

                Build2: { node {

                    ettPipeline (

                        task: "${ETT_TASK2}",

                        pkg: "${ETT_PACKAGE2}",

                        scm_url: "${SCM_URL2}",

                        clentry: "${NOTE2}",

                        email: "${EMAIL}"

                    )

                }},

            )

        }

    }

    catch(e)

{         currentBuild.result = "FAILED"         throw e     }
Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

andrew.bayer@gmail.com (JIRA)

unread,
Nov 1, 2018, 1:30:01 PM11/1/18
to jenkinsc...@googlegroups.com
Andrew Bayer resolved as Not A Defect
 

This is intended and correct behavior - you can only run one Declarative Pipeline per run, meaning you can't nest them and you can't run two in parallel within the same Jenkinsfile.

Change By: Andrew Bayer
Status: Open Resolved
Resolution: Not A Defect

bitwiseman@gmail.com (JIRA)

unread,
Oct 22, 2019, 11:24:18 PM10/22/19
to jenkinsc...@googlegroups.com
Liam Newman closed an issue as Not A Defect
 

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