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

Updating podTemplate does not immediately come into effect.

    XMLWordPrintable

Details

    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

            vincentheet Vincent Heet added a comment -

            Thanks for the hint of using a UUID csanchez 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

            vincentheet Vincent Heet added a comment - Thanks for the hint of using a UUID csanchez  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

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

            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

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

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

            csanchez Do you still think I should use UUID or the bug is fixed? Because I faced the same issue last night. It picked up a stale template with the same name. Where does it store/cache the template? What if I completely override the template file, but keep the label same? It doesn't work for me as of now, every time I change a template I have to change the label. 

            inquisitive anshu pitlia added a comment - csanchez Do you still think I should use UUID or the bug is fixed? Because I faced the same issue last night. It picked up a stale template with the same name. Where does it store/cache the template? What if I completely override the template file, but keep the label same? It doesn't work for me as of now, every time I change a template I have to change the label. 
            hak33m16 Hakeem added a comment - - edited

            Just ran into this today, and it turned out it was because my pod label had invalid characters in it (in this case, specifically % signs, because I was grabbing the name of the branch from Jenkins which had an escaped forward slash in it). No information related to an issue with the label was present in the logs of the instance, it seemed to accept it perfectly fine, but would ignore it in in favor of using the default (which is what I'd previous had specified) of jenkins-agent-<uuid>

            Ended up sanitizing the label using .replaceAll("[/\\.%]", "-"), hopefully I can save somebody else a couple hours

            hak33m16 Hakeem added a comment - - edited Just ran into this today, and it turned out it was because my pod label had invalid characters in it (in this case, specifically % signs, because I was grabbing the name of the branch from Jenkins which had an escaped forward slash in it). No information related to an issue with the label was present in the logs of the instance, it seemed to accept it perfectly fine, but would ignore it in in favor of using the default (which is what I'd previous had specified) of jenkins-agent-<uuid> Ended up sanitizing the label using .replaceAll(" [/\\.%] ", "-") , hopefully I can save somebody else a couple hours

            People

              vlatombe Vincent Latombe
              larslawoko Lars Lawoko
              Votes:
              2 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: