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

Nested PodTemplate erroneous behaviour

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Minor Minor
    • kubernetes-plugin
    • None

      See the following:

       

      podTemplate(label: 'x', inheritFrom: 'JenkinsDeployer', nodeUsageMode: 'EXCLUSIVE') {
          node('x') {
              echo env.environment
              podTemplate(label: 'y', inheritFrom: 'JenkinsLiveDeployer', nodeUsageMode: 'EXCLUSIVE') {
                  node('y') {
                      echo env.environment
                  }
              }
          }
      }

       

      Assuming there are pod templates for a 'JenkinsDeployer' which have a set of environment variables and then a pod template for 'JenkinsLiveDeployer', which has a different set of environment variables, then I would expect to see a different value for each echo statement.

       

      Right now, assuming environment on each pod template are respectively pre-production and and production, the actual result of the code snippet above is:

       

      // node starting
      'pre-production'
      
      // node starting
      'pre-production'
      

       

      whereas the expected value should be:

      // node starting
      'pre-production'
      
      // node starting
      'production'
      

       

      This should be the same behaviour as doing the following but it is *not*:

       

      node('label') {
        echo env.environment
        node('live-label') {
          echo env.environment
        }
      }

       

            Unassigned Unassigned
            cwebbtw Christopher Webb
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: