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

Updating podTemplate does not immediately come into effect.

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      When updating a PodTemplate (specifically a containerTemplate) through a jenkinsfile change, the change is not immediately put into effect.

      This seems to be some kind of caching issue, in older versions you could see this through the "Configure System" which would have the old template still populated. Is it especially apparent when someone is on a branch improving the build , but "old" template builds are still happening on master with the same label. In this situation it seems a bit of a race condition as to which version is picked up in the job.

      Workaround;
      We have resorted to changing the template label to force a cache bust. e.i
      label: 'GitPod1' ... label: 'GitPod2' etc. which works reliably.

      P.S Finally getting around to recording some bugs that I have known about for a while, sorry for the spam

        Attachments

          Issue Links

            Activity

            Hide
            csanchez Carlos Sanchez added a comment -

            jenkins will pick a pod template based on the label, if you have more than one pod template serving the same label you may get the wrong one.
            You should use uuids as labels to avoid that

            # this guarantees the node will use this template
            def label = "mypod-${UUID.randomUUID().toString()}"
            podTemplate(label: label) {
                node(label) {
            

            I have never seen the kubernetes-podtemplates.xml file

            Show
            csanchez Carlos Sanchez added a comment - jenkins will pick a pod template based on the label, if you have more than one pod template serving the same label you may get the wrong one. You should use uuids as labels to avoid that # this guarantees the node will use this template def label = "mypod-${UUID.randomUUID().toString()}" podTemplate(label: label) { node(label) { I have never seen the kubernetes-podtemplates.xml file
            Show
            csanchez Carlos Sanchez added a comment - See https://github.com/jenkinsci/kubernetes-plugin/pull/281
            Hide
            vincentheet Vincent Heet added a comment -

            Thanks for the hint of using a UUID Carlos Sanchez that will definitely fix the issue. I'm a bit confused by you saying you have never seen the kubernetes-podtemplate.xml. It is mentioned in the code here: https://github.com/jenkinsci/kubernetes-plugin/blob/023f8e252fab8896e0ade1fb1b233433f20ce7dc/src/main/java/org/csanchez/jenkins/plugins/kubernetes/pipeline/PodTemplateMap.java#L138

            Show
            vincentheet Vincent Heet added a comment - Thanks for the hint of using a UUID Carlos Sanchez  that will definitely fix the issue. I'm a bit confused by you saying you have never seen the kubernetes-podtemplate.xml. It is mentioned in the code here:  https://github.com/jenkinsci/kubernetes-plugin/blob/023f8e252fab8896e0ade1fb1b233433f20ce7dc/src/main/java/org/csanchez/jenkins/plugins/kubernetes/pipeline/PodTemplateMap.java#L138
            Hide
            csanchez Carlos Sanchez added a comment -

            ah, kubernetes-podtemplate.xml was just added to persist the pipeline defined templates. It should always match what's in the pipeline

            Show
            csanchez Carlos Sanchez added a comment - ah, kubernetes-podtemplate.xml was just added to persist the pipeline defined templates. It should always match what's in the pipeline
            Hide
            csanchez Carlos Sanchez added a comment -

            This is probably fixed at least partially with https://github.com/jenkinsci/kubernetes-plugin/pull/285

            Show
            csanchez Carlos Sanchez added a comment - This is probably fixed at least partially with https://github.com/jenkinsci/kubernetes-plugin/pull/285

              People

              • Assignee:
                vlatombe Vincent Latombe
                Reporter:
                larslawoko Lars Lawoko
              • Votes:
                2 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: