jenkins plugin configuration as code - ghdrako/doc_snipets GitHub Wiki
JCasC is a Jenkins plugin that allows you to store and maintain your Jenkins configuration in a YAML file.
By default, the YAML file for the CasC configuration is located in $JENKINS_HOME/jenkins.yaml. The location and name of the file being used is displayed on the Configuration as Code UI page. You can specify a different file to view by typing the full pathname into the Path or URL field.
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/casc_configs.
- A full path to a single file. For example, /var/jenkins_home/casc_configs/jenkins.yaml.
- A URL pointing to a file served on the web. For example, https://acme.org/jenkins.yaml.
nstead of setting the CASC_JENKINS_CONFIG environment variable, you can also define using the casc.jenkins.config Java property. This is useful when installing Jenkins via a package management tool and can't set an environment variable outside of a package-managed file, which could be overwritten by an update. For RHEL/CentOS systems, you can append the following to the JENKINS_JAVA_OPTIONS entry in /etc/sysconfig/jenkins
-Dcasc.jenkins.config=/jenkins/casc_configs
If you do not set the CASC_JENKINS_CONFIG environment variable or the casc.jenkins.config Java property, the plugin will default to looking for a single config file in $JENKINS_HOME/jenkins.yaml.
On Linux systems, you can run systemctl edit jenkins and add the following:
[Service]
Environment="JAVA_OPTS=-Dcasc.jenkins.config=/jenkins/casc_configs"