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

inheritFrom cannot overwrite inherited images

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • kubernetes-plugin
    • Jenkins 2.319.1
      kubernetes plugin 1.31.2 3724.v0920c1e0ec69
      pipeline 2.6

      pipeline script

       

      pipeline {
        agent {
          kubernetes {
            inheritFrom 'maven'
            yaml '''
            spec:
              containers:
              - name: maven
                image: my-mavenimage
                volumeMounts:
                - mountPath: "/root/.m2"
                  subPath: mvn_cache
                  name: "volume-cache"
                  readOnly: false
                - mountPath: "/root/.sonar/cache"
                  subPath: sonar-cache
                  name: "volume-cache"
                  readOnly: false
              - name: jnlp
                volumeMounts:
                - mountPath: "/root/.sonar/cache"
                  subPath: sonar-cache
                  name: "volume-cache"
                  readOnly: false
                - mountPath: "/root/.m2"
                  subPath: mvn_cache
                  name: "volume-cache"
                  readOnly: false
              volumes:
              - persistentVolumeClaim:
                  claimName: rule
                name: "volume-cache"
      '''
            defaultContainer 'maven'
          }
        } 

      parent pod template  casc

       

       

      -containers:
      -command:"cat"
      image:"parent image"
      livenessProbe:
      failureThreshold:0
      initialDelaySeconds:0
      periodSeconds:0
      successThreshold:0
      timeoutSeconds:0
      name:"maven"
      resourceLimitCpu:"4000m"
      resourceLimitMemory:"8192Mi"
      resourceRequestCpu:"100m"
      resourceRequestMemory:"100Mi"
      ttyEnabled:true
      workingDir:"/home/jenkins/agent"

       
      The pod is still started using the parent image, pod log

      spec:
        containers:
        - command:
          - "cat"
          image: "parent image"
          imagePullPolicy: "IfNotPresent"
          name: "maven"
          resources: 

            Unassigned Unassigned
            elrond elrond
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: