As I don't use the helm-charts,I can't answer authoritatively, but it is supported in the abstract. According to the JCasC Getting Started documentation:
First, start a Jenkins instance with the Configuration as Code plugin installed.
- Those running Jenkins as a Docker container (and maybe also pre-installing plugins), do include Configuration as Code plugin.
Second, the plugin looks for the CASC_JENKINS_CONFIG
environment variable. The variable points to a comma-separated list of any of the following:
- Path to a folder containing a set of config files. For example,
/var/jenkins_home/init.CasC
.
- A full path to a single file. For example,
/var/jenkins_home/init.CasC/jenkins.yaml
.
- A URL pointing to a file served on the web. For example,
https://acme.org/jenkins.yaml
.
If an element of CASC_JENKINS_CONFIG
points to a folder, the plugin will recursively traverse the folder to find file(s) with .yml,.yaml,.YAML,.YML
suffix. It will exclude hidden files or files that contain a hidden folder in any part of the full path. It follows symbolic links for both files and directories.
So, yes, you can have multiple yml
files. I have over 20 (for 120 plugins). They are broken down by capability (eg: global, agents, tools, credentials , including 2 for RBAC (1 for roles, for users, etc.)), plus some plugin specific yml
files. Some are also reused across instances while others are specific.
You should be aware of Merge Strategy in the event of conflicts:
- ErrorOnConflictMergeStrategy (default)
- The strategy name is errorOnConflict.
- Throws an exception if there's a conflict in multiple YAML files.
- OverrideMergeStrategy
- The strategy name is override
- Override the config files according to the loading order.
Also be aware when updating an existing instance, certain plugin configurations may replace configurations, while others may augment an existing configuration, regardless of one yaml or many. And of course, not 100% of options are JCasC-able yet, so some init.groovy is also required. YMMV.
You may also wish to review: JCasC Handling Secrets.