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

Read pod template yaml from library resource

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Minor Minor
    • kubernetes-plugin
    • Jenkins 2.150.1
      Kubernetes::Pipeline::DevOps Steps 1.5
      Kubernetes::Pipeline::Kubernetes Steps 1.5
      Kubernetes::Plugin 1.14.0

      I'd like to move pod definition from pipeline to a file resource in a shared library.
       
      My pipeline is like:

      pipeline {
          agent none
          stages {     
              stage('step-in-kubernetes') {
                  agent {
                      kubernetes {
                          label 'kube'
                          yamlFile libraryResource('myPod.yaml')
                      }
                  }       
                  stages {
                      stage('Checkout') {
                          steps {
                              checkout([$class: 'MercurialSCM', clean: true,
                                  source: 'https://acme.com/hg/myproject'])
                          }
                      }
      
                  } 
              }
          }
      }
      

       
      I put 'myPod.yaml' in resources folder of my library.
      I get an error saying that HG is not installed.

      But:

      • it's work if I used yaml property instead of yamlFile
      • libraryResource fails when using wrong filename
         

            csanchez Carlos Sanchez
            arnaud Arnaud Bourree
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: