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

YAML definition of jnlp container isn't updated with env variables and arguments

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • kubernetes-plugin
    • None
    • Jenkins 2.111
      Kubernetes 1.5

      Hi, thanks for adding yaml support. But i got in trouble while defining my custom jnlp container. I defined it like bellow, but the arguments and environment variables (secret, worker/pod name) won't be added to the definition, when the pod is scheduled.

      Pipeline definition

      def label = "buildpod-${UUID.randomUUID().toString()}"
      podTemplate(
        label: label,
        yaml: """
      apiVersion: v1
      kind: Pod
      metadata:
        labels:
          jenkins: slave
          jenkins/testbuild2: "true"
      spec:
        containers:
        - name: buildenv
          command:
          - cat
          image: dr:5000/admin/buildenv:161
          imagePullPolicy: Always
          securityContext:
            privileged: false
          tty: true
        - name: jnlp
          image: dr:5000/base/jenkins_jnlp_slave:3.18
          imagePullPolicy: Always
          securityContext:
            privileged: false
          tty: true
        automountServiceAccountToken: false
      """
      )
      

      YAML definition of scheduled jenkins slave pod:

      Containers:
        buildenv:
          Container ID:  
          Image:         dr:5000/admin/buildenv:161
          Image ID:      
          Port:          <none>
          Host Port:     <none>
          Command:
            cat
          State:          Waiting
            Reason:       ContainerCreating
          Ready:          False
          Restart Count:  0
          Environment:    <none>
          Mounts:
            /home/jenkins from workspace-volume (rw)
        jnlp:
          Container ID:   
          Image:          dr:5000/base/jenkins_jnlp_slave:3.18
          Image ID:       
          Port:           <none>
          Host Port:      <none>
          State:          Waiting
            Reason:       ContainerCreating
          Ready:          False
          Restart Count:  0
          Environment:    <none>
          Mounts:
            /home/jenkins from workspace-volume (rw)
      

      I expect the pod defined like this:

        jnlp:
          Container ID:  docker://aee29ef4c754c60a819c069dc74c26d32dc9fe038eceac94e2e1eda3f630bea0
          Image:         dr:5000/base/jenkins_jnlp_slave:3.18
          Image ID:      docker-pullable://dr:5000/base/jenkins_jnlp_slave@sha256:9e30352e9f0790f6d5b947d22245bb6d13fa6bb4f138a0b8e30043bbc099bd81
          Port:          <none>
          Host Port:     <none>
          Args:
            x
            jenkins-slave-txzpb-zl5s9
          State:          Running
            Started:      Tue, 03 Apr 2018 10:53:13 +0200
          Ready:          True
          Restart Count:  0
          Environment:
            JENKINS_SECRET:  x
            JENKINS_NAME:    jenkins-slave-txzpb-zl5s9
            JENKINS_URL:     http://y:8080/
            HOME:            /home/jenkins
      

            csanchez Carlos Sanchez
            stephankirsten Stephan Kirsten
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: