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

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

XMLWordPrintable

      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}"'
                          }
                      }
                  }
              }
          }
      

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

              Created:
              Updated: