I’m using the role-strategy plugin, configure it with the help of the jenkins-configuration-as-code
plugin and deploy from the official Helm chart v4.1.14. When using the role-strategy plugin, it is recommended to also set the projectNamingStrategy
to roleBased
.
When configuring it in JCasC though, I get the following error:
2022-08-08 13:46:39.788+0000 [id=93] WARNING h.i.i.InstallUncaughtExceptionHandler#handleException: Caught unhandled exception with ID 41b013aa-e67b-4cc4-a9df-2f08b59387ae
io.jenkins.plugins.casc.ConfiguratorException: Found incompatible configuration elements YamlSource: /var/jenkins_home/casc_configs/role-strategy.yaml in /var/jenkins_home/casc_configs/role-strategy.yaml, line 4,
column 5:
roleBased:
^
at io.jenkins.plugins.casc.yaml.ErrorOnConflictMergeStrategy.merge(ErrorOnConflictMergeStrategy.java:21)
at io.jenkins.plugins.casc.yaml.ErrorOnConflictMergeStrategy.merge(ErrorOnConflictMergeStrategy.java:46)
at io.jenkins.plugins.casc.yaml.ErrorOnConflictMergeStrategy.merge(ErrorOnConflictMergeStrategy.java:46)
at io.jenkins.plugins.casc.yaml.YamlUtils.merge(YamlUtils.java:47)
Caused: io.jenkins.plugins.casc.ConfiguratorException: Failed to read YamlSource: /var/jenkins_home/casc_configs/role-strategy.yaml
at io.jenkins.plugins.casc.yaml.YamlUtils.merge(YamlUtils.java:51)
at io.jenkins.plugins.casc.yaml.YamlUtils.loadFrom(YamlUtils.java:102)
at io.jenkins.plugins.casc.ConfigurationAsCode.configureWith(ConfigurationAsCode.java:637)
...
The file /var/jenkins_home/casc_configs/role-strategy.yaml
looks like this:
jenkins:
projectNamingStrategy:
roleBased:
forceExistingJobs: true
authorizationStrategy:
roleBased:
roles:
global:
...
The issue seems to be, that the key is already set in templates/jcasc-config.yaml
(it’s actually in the _helpers.tpl
but used in the template) of the Helm chart. If I manually remove that line, applying the configs works. Strangely not even setting the same config projectNamingStrategy: "standard"
works. It produces the same error.
Is there any known way of getting around this issue? Or is this a bug in the Helm chart or in the JCasC Yaml merging?