Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-60855

Declarative Pipeline : 'parallel' make 'environments' not accessible in the 'post' block

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      When using a parallel block alone in a stages block, the "environment" definition of variables is lost when used in a post block.

      This issue can be reproduced using this pipeline:

         pipeline {
              agent any
              stages {
                  stage("Tests") {
                      environment {
                          foo = "${JOB_NAME}-${BUILD_ID}-${STAGE_NAME}"
                      }
                      parallel {
                          stage("test") {
                              steps {  
                                  sh 'echo "foo_inside_parallel: ${foo}"'
                              }
                          }
                      }
                      post {
                          always {
                              sh 'echo "foo_inside_post: ${foo}"'
                          }
                      }
                  }
              }
          }
      

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            philippe_dupont Philippe Dupont
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: