我有values.yaml,它运行得很好。
我想添加Jcasc-Config Yml来自动添加管道,但找不到values.Yml文件的格式。
目前我有以下内容,并希望参考Jenkins.yaml
JCasC:
enabled: true
pluginVersion: 1.35
configScripts:
welcome-message: |
jenkins:
systemMessage: Welcome to our CICD server. This Jenkins is configured and managed 'as code'.
configScripts:
部分应该放些什么?只是configScripts: ./jenkins.yaml
?
您还可以使用job DSL
插件,该插件允许您以更干净的方式传递Jenkins管道。你的代码看起来是这样的:
installPlugins:
... << all your other plugins >>
- job-dsl:1.77
...
JCasC:
configScripts:
base-config: |-
... << your other plugin config >>
jobs:
- script: >
pipelineJob('unit-tests') {
<< your pipeline config >>
}
...
查看JCasC演示中的示例。还有一件事需要补充,一旦您添加了jobDSL插件,您的Jenkins实现上就有一个API端点可用:https://your-jenkins-url/plugin/job-dsl/api-viewer/index.html,它提供了可以为每个jobDSL方法设置的所有参数的详细描述。
能够添加如下作业,
jobs:
Test-Job: |-
<?xml version='1.0' encoding='UTF-8'?>
<project>
<keepDependencies>false</keepDependencies>
<properties/>
<scm class="hudson.scm.NullSCM"/>
<canRoam>false</canRoam>
<disabled>false</disabled>
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
<triggers/>
<concurrentBuild>false</concurrentBuild>
<builders/>
<publishers/>
<buildWrappers/>
</project>