Versioning Configuration

Keeping Configuration as Code Under Version Control

The four files live in BookNest's repository under ci/jenkins, so controller changes are reviewed like code:

The history of the controller's configurationShell
git log --oneline -2 -- ci/jenkins
Output
03758bb Generate a multibranch job for the shared library too
d24298a Add the Jenkins controller as code: plugins, casc.yaml and Job DSL

The second commit needed no restart: with the checkout mounted, a POST to /configuration-as-code/reload (with a CSRF crumb) re-ran jobs.groovy, which logged createOrUpdateConfig for both jobs. In production, a pipeline would apply each merged change.

Change the controller only through the files, or the next reload undoes the click. Keep secrets out of Git 1,932 (JCasC 2,791 warns that environment variables are readable by jobs on the controller). Upgrade plugins by editing plugins.txt and rebuilding. Build history still lives only in JENKINS_HOME, so back it up anyway (Backing Up JENKINS_HOME). The throwaway controller, volume and image were removed afterward.