Issue
I am trying to automate the provisioning of the Jenkins instance.
My current pipeline depends on a config file being managed by the "Config File Provider Plugin".
I need to know how to add the new config file as part of the Jenkins init hook (init.groovy.d
)
Solution
Solved:
configFiles {
groovyScript {
id("Jenkinsfile")
name("Jenkinsfile")
comment("Jenkinsfile to be used by pipeline-multibranch-defaults plugin")
content("""
library identifier: 'ci-pipeline@master',
retriever: modernSCM([\$class: 'GitSCMSource', remote: 'https://github.com/ci-pipeline/ci-pipeline.git'])
node {
checkout scm
ci('.ci-pipeline.yaml')
}
""")
}
}
see:
http://<your jenkins domain>/plugin/job-dsl/api-viewer/index.html#path/configFiles
Answered By - Muhammad Hewedy