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

kubernetes plugin picks first cloud without considering inheritFrom field

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • kubernetes-plugin
    • None
    • Jenkins 2.303.3
      kubernetes plugin 1.30.1

      Kubernetes plugin doesn't take inheritFrom field value when selecting Kubernetes plugin if cloud parameter is specified. Also current plugin behavior is not deterministic and depends on order in which clouds were registered in Jenkins.

       

      Example:

      I have 2 kubernetes clouds configured:

      Cloud A (was registered first): no templates

      Cloud B (registered after cloud A): template 'nonprod' is configured

      I'm running next code:

      stage("Custom Agent") {
       podTemplate(inheritFrom: "nonprod", containers: [...]) {
         ...
       }
      } 

      Current plugin behavior would pick Cloud A without any consideration about inheritFrom field value. See code here: https://github.com/jenkinsci/kubernetes-plugin/blob/master/src/main/java/org/csanchez/jenkins/plugins/kubernetes/pipeline/PodTemplateStepExecution.java#L166

      Combined that plugin ignores inheritance if it can't find template this behavior make hard to troubleshoot why job doesn't work.

      Suggested fix is to do cloud resolution taking into account value of inheritFrom field

       

            Unassigned Unassigned
            olegz_zoom Oleg Zheltyannikov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: