jenkinsci / configuration-as-code-plugin

Jenkins Configuration as Code Plugin
https://plugins.jenkins.io/configuration-as-code
MIT License
2.7k stars 720 forks source link

JCasC in Kubernetes #2572

Open danielstankw opened 1 month ago

danielstankw commented 1 month ago

Jenkins and plugins versions report

Hi, I am using Jenkins deployed in Kubernetes. I also used CasC which I define in values.yaml section of the helm chart, by adding it to the configScripts section. It works but its not optimal. I would like to have CaSc defined outside of values.yaml and inject it, I tried:

Placing casc.yaml config files in the folder of "/var/jenkins_home/casc_config/jenkins.yaml but I wasnt able to get it to work Similarly adding git repo with yamls in ConfigUrls didnt work. I guess issue could be due to lack of permissions or wrong setup, would anyone who got it to work be able to share with me how they configured it?

JCasC:

-- Enables default Jenkins configuration via configuration as code plugin

defaultConfig: true

# If true, the init container deletes all the plugin config files and Jenkins Config as Code overwrites any existing configuration
# -- Whether Jenkins Config as Code should overwrite any existing configuration
overwriteConfiguration: false
# -- Remote URLs for configuration files.
configUrls: []
# - https://acme.org/jenkins.yaml
# -- List of Jenkins Config as Code scripts
configScripts: 
  welcome-message: |
    jenkins:
      systemMessage: Welcome to our CI\CD server. This Jenkins is configured and managed 'as code'.

What Operating System are you using (both controller, and any agents involved in the problem)?

Ubuntu

Reproduction steps

xxx

Expected Results

xxx

Actual Results

xxx

Anything else?

xxx