Podtemplate() not accepting the yaml file using readFile or yamlFile

6/19/2019

my code:

podTemplate(label: slave_label, cloud: ${cloud_name}, readFile : 'deploy.yml') {

}

I used yamlFile and readFile also its not taking the inputs. bddrunner pod is not starting

When I use this direct yaml method its working fine. like this:

podTemplate(label: slave_label, cloud: ${cloud_name}, yaml: """ """) {
}

How can I fix this?

-- ajith krishna
jenkins
kubernetes
readfile

2 Answers

7/10/2019
-- csanchez
Source: StackOverflow

3/13/2020

yamlFile: readFile('path-to-file')

It must be noted that readFile only works inside an active workspace. That means you have to be in a Node section. https://jenkins.io/doc/pipeline/steps/workflow-basic-steps/#readfile-read-file-from-workspace

Your code should be:

podTemplate(label: slave_label, cloud: ${cloud_name}, yaml: readFile('deploy.yml')) {

}
-- Zauxst
Source: StackOverflow