Jenkins Helm Chart - cannot update CASC_JENKINS_CONFIG environment variable

147 Views Asked by At

I'm installing Jenkins via their helm charts. I have a values file set up, and also have some JCasC yaml. I wanted to split up the JCasC into multiple files as the contents of the JCasC bloated the values file too much. I was able to split off multiple CasC.yaml files to another folder, and then load them as a config map to the pod, so that is working.

What I'm having a problem with is the environment variable in the container (CASC_JENKINS_CONFIG). If I try to set this via the yaml, I get an error spec.template.spec.containers[0].env[7].name: duplicate name "CASC_JENKINS_CONFIG". The Config as Code plugin allows for multiple locations of config files, so there must be some way to specify multiple locations to this file.

It seems the Jenkins helm chart is overriding this env variable somehow. Is there a way to set it so that the config As Code plugin looks in multiple locations?

1

There are 1 best solutions below

0
Jay Blanchard On

According to https://github.com/jenkinsci/configuration-as-code-plugin/tree/master you can define multiple folders for the CASC_JENKINS_CONFIG by separating them with commas:

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/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.
containerEnv:
    # Tell the plugin where to find its config.
    - name: CASC_JENKINS_CONFIG
      value: "/var/jenkins_home/casc_configs,/var/jenkins_home/custom_casc_configs"