[JIRA] (JENKINS-57939) Nested PodTemplate erroneous behaviour

7 views
Skip to first unread message

cwebb@thoughtworks.com (JIRA)

unread,
Jun 10, 2019, 10:23:02 AM6/10/19
to jenkinsc...@googlegroups.com
Christopher Webb created an issue
 
Jenkins / Bug JENKINS-57939
Nested PodTemplate erroneous behaviour
Issue Type: Bug Bug
Assignee: Carlos Sanchez
Components: kubernetes-plugin
Created: 2019-06-10 14:22
Priority: Minor Minor
Reporter: Christopher Webb

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'

 

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

cwebb@thoughtworks.com (JIRA)

unread,
Jun 10, 2019, 10:25:02 AM6/10/19
to jenkinsc...@googlegroups.com
Christopher Webb updated an issue
Change By: Christopher Webb
See the following:

 
{code:java}

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

 

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:

 
{code:java}

// node starting
'pre-production'

// node starting
'pre-production'
{code}
 


whereas the expected value should be:
{code:java}

// node starting
'pre-production'

// node starting
'production'
{code}
 

This should be the same behaviour as doing:

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

cwebb@thoughtworks.com (JIRA)

unread,
Jun 10, 2019, 10:25:02 AM6/10/19
to jenkinsc...@googlegroups.com
This should be the same behaviour as doing the following but it is **not** :


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

jglick@cloudbees.com (JIRA)

unread,
Jul 16, 2019, 3:26:02 PM7/16/19
to jenkinsc...@googlegroups.com
Jesse Glick resolved as Duplicate
 

No steps to reproduce were provided, but this sounds similar to JENKINS-58374.

Change By: Jesse Glick
Status: Open Resolved
Assignee: Carlos Sanchez
Resolution: Duplicate
Reply all
Reply to author
Forward
0 new messages