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

declarative pipeline pod inheritance not working as documented

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Blocker Blocker
    • kubernetes-plugin
    • None
    • Jenkins 2.362
      kubernetes (plugin version) 3690.va_9ddf6635481

      Currently following documentation found at https://plugins.jenkins.io/kubernetes/#plugin-content-inheritance for leveraging pod template inheritance. 

      Following the example does not produce the expected outcome where the resulting pod container uses an updated image for the specified container.

      JCasC pod base template definition

      templates:
      - name: "jenkins-agent"
        namespace: "jenkins-agents"
        containers:
        - name: jnlp
          image: jnlp:latest
          command: "tail -f /dev/null"
          workingDir: "/home/jenkins/agent"
        - name: maven
          image: maven:latest
          command: "tail -f /dev/null"

      Declarative pipeline definition

      pipeline {
        agent {
          kubernetes {
            cloud 'gke'
            inheritFrom 'jenkins-agent'
            yaml '''
            spec:
              containers:
              - name: maven
                image: maven:3.8.1-jdk-11
      '''
          }
        }
        stages {
          ...
        }
      }

      The resulting agent pod still contains the base maven image rather than the attempted overridden version for the maven container.

            Unassigned Unassigned
            ryanatkins20 Ryan
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: