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

inheritFrom ignored when getting pod from shared-library with libraryResource

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • kubernetes-plugin
    • None

      Scenario 0:

      I have a custom pod defined on my shared-library that I usualy use for some pipelines.

      pipeline{
          agent {
              kubernetes {
                  yaml libraryResource("kubernetes/pod/custom-pod.yaml")
                  defaultContainer 'jnlp'
              }
        } 

      Result: custom-pod runs as expected.

      Scenario 1:
      There is a pipeline where I need to define a ephemeral-storage request. I didn't want to create another custom pod, so I wanted to resuse the custom-pod and merged the changes I needed using the inheritFrom attribute from kubernetes-plugin.

      pipeline{
          agent {
              kubernetes {
                  inheritFrom libraryResource("kubernetes/pod/custom-pod.yaml")
                  yaml '''
                      spec:
                        containers:
                          - name: jnlp
                            resources:
                              requests:
                                ephemeral-storage: "16Gi"
                      '''
                  defaultContainer 'jnlp'
              }
          }

      Result: inheritFrom is ignored. instead the kubernetes default template is merged with the yaml defined.

            Unassigned Unassigned
            viriatis viriatis
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: