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

Cannot use inheritFrom when PodTemplateContext exists

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • kubernetes-plugin
    • None
    • 1.15.7

      When using a nested declarative Kubernetes agent, it implicitly uses the current PodTemplateContext as parent template.

      https://github.com/jenkinsci/kubernetes-plugin/blob/46cdc75063dc5617445972a08eaead460457af28/src/main/java/org/csanchez/jenkins/plugins/kubernetes/pipeline/PodTemplateStepExecution.java#L85

       

      There are 2 situations when this can lead to unexpected behaviors : 

      • declaring explicit inheritFrom will not work without displaying any clear warning
      • When scheduling a pod template on a specific machine, where a limited set of images are allowed to run, it can fail running the slave.

      To avoid such situation, what do you think about those 2 solutions : 

      • inheritFrom has priority over template context.
        • When it is empty, no parent context will be used
        • When null, the current template context will be used (current behavior)
        • when non null and not empty, use it as the parent template
      • Add a new option to avoid implicit template inheritance 

            csanchez Carlos Sanchez
            hypnoce Francis JAC
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: