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

declarative pipeline should be able to override a named podTemplate to change things

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Won't Do
    • Icon: Minor Minor
    • kubernetes-plugin
    • None

      it would be nice to use declarative pipeline to refer to a named podTemplate like in JENKINS-48140 but be able to override any part of the podTemplate with app-specific stuff. e.g. if a particular app wanted to use a custom maven version - while reusing the same global podTemplate configuration.

      e.g. something like

      pipeline {
        agent {
          kubernetes {
            overridePodTemplate {
              name "fabric8-maven"
              containerTemplate {
                name "maven"
                image "maven:3.5.1"
              }
            }
          }
        }
      ...
      }

       

      i.e. it'd reuse the podTemplate called "fabric8-maven" configured in Manage Jenkins -> Configure System -> Cloud -> Kubernetes -> Pod Templates

      then in this case it'd override the image for the container called maven

      I'd be able to do a PR myself for this only am not sure how to represent the `overridePodTemplate` class so that it can have > 1 `containerTemplate expressions to override all possible containerTemplates on the podTemplate in declarative markup.

       

      Though I noticed the inheritFrom property on podTemplate so I wonder if something like this is meant to work?

      pipeline {
        agent {
          kubernetes {
            podTemplate {
              inheritFrom "fabric8-maven"
              containerTemplate {
                name "maven"
                image "maven:3.5.1"
              }
            }
          }
        }
      ...
      }

       

            csanchez Carlos Sanchez
            jstrachan James Strachan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: