With the following file:
jenkins:
systemMessage: "Test 123"
And the following command line (I did get the jenkins-cli.jar from the same jenkins host):
java -jar jenkins-cli.jar -s http://localhost:8080/ check-configuration <jenkins.yaml
There is an error:
ERROR: Unexpected exception occurred while performing apply-configuration command.
io.jenkins.plugins.casc.ConfiguratorException: Found conflicting configuration at YamlSource: java.io.BufferedInputStream@52a762 in java.io.BufferedInputStream@52a762, line 2, column 20:
systemMessage: "Test 123"
^
The same problem exists with apply.
The same problem exists when trying with curl:
curl -v -X POST -T jenkins.yaml "http://localhost:8080/configuration-as-code/apply"
Uploading directly in the GUI does work.
The same error happens with:
curl \
-v \
-X POST \
--data-binary @jenkins.yaml \
http://localhost:8080/configuration-as-code/check
I must have corrupted my jenkins installation somehow, because at this point after a fresh install I cannot reproduce the problem.
Same problem here :
$ java -jar check-deployment/jenkins-cli.jar -auth $USER:$PASSWORD who-am-i
Authenticated as: admin
Authorities:
authenticated
$ java -jar check-deployment/jenkins-cli.jar -auth $USER:$PASSWORD version
2.150.1
$ java -jar check-deployment/jenkins-cli.jar -auth $USER:$PASSWORD list-plugins | grep configuration-as-code
configuration-as-code-support Configuration as Code Support Plugin 1.3
configuration-as-code Configuration as Code Plugin 1.3
$ cat jenkins.yml
jenkins:
systemMessage: "Jenkins configured automatically by CasC"
$ cat jenkins.yml | java -jar check-deployment/jenkins-cli.jar -auth $USER:$PASSWORD check-configuration
ERROR: Unexpected exception occurred while performing check-configuration command.
io.jenkins.plugins.casc.ConfiguratorException: Found conflicting configuration at YamlSource: java.io.BufferedInputStream@6f26cad6 in java.io.BufferedInputStream@6f26cad6, line 2, column 18:
systemMessage: "Jenkins configured automaticall ...
^
at io.jenkins.plugins.casc.yaml.YamlUtils.merge(YamlUtils.java:96)
at io.jenkins.plugins.casc.yaml.YamlUtils.merge(YamlUtils.java:82)
at io.jenkins.plugins.casc.yaml.YamlUtils.merge(YamlUtils.java:82)
at io.jenkins.plugins.casc.yaml.YamlUtils.merge(YamlUtils.java:40)
Caused: io.jenkins.plugins.casc.ConfiguratorException: Failed to read YamlSource: java.io.BufferedInputStream@6f26cad6
at io.jenkins.plugins.casc.yaml.YamlUtils.merge(YamlUtils.java:43)
at io.jenkins.plugins.casc.yaml.YamlUtils.loadFrom(YamlUtils.java:106)
at io.jenkins.plugins.casc.ConfigurationAsCode.checkWith(ConfigurationAsCode.java:557)
at io.jenkins.plugins.casc.ConfigurationAsCode.checkWith(ConfigurationAsCode.java:552)
at io.jenkins.plugins.casc.cli.CheckConfigurationCommand.run(CheckConfigurationCommand.java:34)
at hudson.cli.CLICommand.main(CLICommand.java:283)
at hudson.cli.CLIAction$PlainCliEndpointResponse$1.run(CLIAction.java:221)
at jenkins.util.FullDuplexHttpService.download(FullDuplexHttpService.java:115)
at jenkins.util.FullDuplexHttpService$Response.generateResponse(FullDuplexHttpService.java:175)
at org.kohsuke.stapler.HttpResponseRenderer$Default.handleHttpResponse(HttpResponseRenderer.java:124)
[...]
@yogeek @martinda your trying to reload your jcasc configuration?
at the CLI commands list at Jenkins check-configuration has a misleading explanation "Apply YAML configuration to instance" - it seems to me they try to apply or check NEW yaml,
reloading works well as far as I know, with reload-jcasc-configuration command
try this: java -jar jenkins-cli.jar -s http://YOUR_JENKINS_URL/ -auth USER:GENERATE_TOKEN reload-jcasc-configuration
@ricardompcarvalho the reload-jcasc-configuration is working well. The problem is with check-configuration and apply-configuration
I get the same error for reload-jcasc-configuration with both CLI and reload using sidecar on K8S
java -jar jenkins-cli.jar -s http://192.168.99.101:30000 -auth USER:TOKEN reload-jcasc-configuration
No such command reload-jcasc-configuration
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Not stale
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Hi, I occur same problem...
It seems not to resolve in the latest release.(I use v1.44)
The Map<String, String> checkWith(YamlSource) method callsgetStandardConfigSources, so conflicting with input YAML.
https://github.com/jenkinsci/configuration-as-code-plugin/blob/1b6dc7bae8ef9a817c94c2f24ce26b6be2abfdf7/plugin/src/main/java/io/jenkins/plugins/casc/ConfigurationAsCode.java#L619-L624
Most helpful comment
Not stale