Title: Message Title
Sergio Merino updated an issue
Jenkins / JENKINS-58709
Nested pod templates inherit container of upper level pod
Change By:
Sergio Merino
kubernetes plugin version: 1.17.2When I run a podTemplate nested, it inherit the containers of the upper level podTemplate. It is a weird behaviour is better to explain it with an exampleCode:{code:java}podTemplate(showRawYaml: true, label: "alpine1", cloud: "Build farm", containers: [ containerTemplate(name: 'alpine', image: 'alpine', ttyEnabled: true, command: "cat")]) {node ("alpine1") {container('alpine') {sh 'whoami'podTemplate(showRawYaml: true, label: "golang", cloud: "Build farm", containers: [ containerTemplate(name: 'golang', image: 'golang', ttyEnabled: true, command: "cat")]) { node ("golang") {container('golang') { sh 'sleep 120'} }}}}} {code} Expected * alpine pod template containers: \{jnlp} \{alpine} * golang pod template containers: \{jnlp} \{golang}What I have: * alpine pod template containers: \{jnlp} \{alpine} * golang pod template containers: \{jnlp} \{golang} \{alpine} Log(removed env variables):{code:java} Still waiting to schedule taskWaiting for next available executor on 'alpine1-dgpx2-5jp6k'Agent alpine1-prfs1-ghwvg is provisioned from template Kubernetes Pod Template---apiVersion: "v1"kind: "Pod"metadata: annotations:buildUrl: "https:// callisto . dev . youview . co.uk/job/CII_test_pod_template_nest/13/ " labels:jenkins: "slave"jenkins/alpine1: "true" name: "alpine1-prfs1-ghwvg"spec: containers: - command:- "cat"env:- name: "JENKINS_SECRET" ...image: "alpine"imagePullPolicy: "IfNotPresent"name: "alpine"resources: limits: {} requests: {}securityContext: privileged: falsetty: truevolumeMounts:- mountPath: "/home/jenkins" name: "workspace-volume" readOnly: falseworkingDir: "/home/jenkins" - env:- name: "JENKINS_SECRET" ...image: "jenkins/jnlp-slave:alpine"name: "jnlp"volumeMounts:- mountPath: "/home/jenkins" name: "workspace-volume" readOnly: false nodeSelector: {} restartPolicy: "Never" volumes: - emptyDir: {}name: "workspace-volume"Running on alpine1-prfs1-ghwvg in /home/jenkins/workspace/CII_test_pod_template_nest[Pipeline] {[Pipeline] container[Pipeline] {[Pipeline] sh+ whoamiroot[Pipeline] podTemplate[Pipeline] {[Pipeline] nodeStill waiting to schedule task'golang-t6g4f-4tzqr' is offlineAgent golang-t6g4f-4tzqr is provisioned from template Kubernetes Pod Template---apiVersion: "v1"kind: "Pod"metadata: annotations:buildUrl: "https:// callisto . dev . youview . co.uk/job/CII_test_pod_template_nest/13/ " labels:jenkins: "slave"jenkins/golang: "true" name: "golang-t6g4f-4tzqr"spec: containers: - command:- "cat"env:- name: "JENKINS_SECRET" ...image: "alpine"imagePullPolicy: