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

Jenkins Kubernetes plugin - Running a sequence of podTemplate with inheritFrom

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • kubernetes-plugin
    • None
    • 1.12.7

       

      Test case

       
      A Pipeline script job as follows, The aim of this pipeline is to show the feature of inheritFrom :
       

      podTemplate(cloud: 'openshift', inheritFrom: 'nodejs', name: 'nodejs-p', label: 'nodejs-p', volumes: [
          persistentVolumeClaim(mountPath: '/home/jenkins/.npm', claimName: 'nodejs', readOnly: false)
      ]) {
       
        node("nodejs-p") {
          stage('BuildFrontend') {
            // some commands
          }
        }
      }
      
      podTemplate(cloud: 'openshift', inheritFrom: 'maven', name: 'maven-p', label: 'maven-p', volumes: [
          persistentVolumeClaim(mountPath: '/home/jenkins/.m2', claimName: 'maven', readOnly: false)
      ]) {
       
        node("maven-p") {
          stage('BuildBackend') {
             // some commands
          }
        }
      }
      
      

       
       

      Outcome

       
      The first podTemplate definition works as expected.
       
      The second podTemplate starts, but instead of using the inheritFrom defined ('maven') it is using the 'nodejs-p' as parent. 
       
      As you guess is wrong and because the nodejs-p template is temporary, the plugin starts the default jenkins-slave container.
       
      If you invert the podTemplate definitions inside the pipeline, so first maven-p and second nodejs-p you obtain the same behaviour. The first works as expected and the second fails.
       
      It looks like a race condition issue.

      Plugin-Version: 0.10
      Hudson-Version: 2.7.4
      Jenkins-Version: 2.7.4
      Plugin-Version: 1.0
      Hudson-Version: 2.32.1
      Jenkins-Version: 2.32.1

            vlatombe Vincent Latombe
            mmascia Mattia Mascia
            Votes:
            3 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: