Skip to content

Commit

Permalink
Add option to overwrite configuration that it's not present in code (#…
Browse files Browse the repository at this point in the history
…985)

Co-authored-by: matandomuertos <[email protected]>
Co-authored-by: jenkins-dependency-updater[bot] <81680575+jenkins-dependency-updater[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tim Jacomb <[email protected]>
  • Loading branch information
5 people authored Feb 22, 2024
1 parent dd713ae commit 1cac0ec
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 1 deletion.
5 changes: 5 additions & 0 deletions charts/jenkins/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,15 @@ Use the following links to reference issues, PRs, and commits prior to v2.6.0.
The changelog until v1.5.7 was auto-generated based on git commits.
Those entries include a reference to the git commit to be able to get more details.

## 5.0.16

Enable support for deleting plugin configuration files at startup.

## 5.0.15

Fixed changelog entries for previous version bumps


## 5.0.14

Update `jenkins/jenkins` to version `2.440.1-jdk17`
Expand Down
2 changes: 1 addition & 1 deletion charts/jenkins/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v2
name: jenkins
home: https://jenkins.io/
version: 5.0.15
version: 5.0.16
appVersion: 2.440.1
description: Jenkins - Build great things at any scale! The leading open source automation server, Jenkins provides over 1800 plugins to support building, deploying and automating any project.
sources:
Expand Down
1 change: 1 addition & 0 deletions charts/jenkins/VALUES_SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ The following tables list the configurable parameters of the Jenkins chart and t
| `controller.JCasC.security` | Jenkins Config as Code for Security section | `legacy` |
| `controller.JCasC.securityRealm` | Jenkins Config as Code for Security Realm | `legacy` |
| `controller.JCasC.authorizationStrategy` | Jenkins Config as Code for Authorization Strategy | `loggedInUsersCanDoAnything` |
| `controller.JCasC.overwriteConfiguration` | Jenkins Config as Code overwrites any existing configuration | `false` |
| `controller.sidecars.configAutoReload` | Jenkins Config as Code auto-reload settings | |
| `controller.sidecars.configAutoReload.enabled` | Jenkins Config as Code auto-reload settings (Attention: rbac needs to be enabled otherwise the sidecar can't read the config map) | `true` |
| `controller.sidecars.configAutoReload.image.registry` | Registry for the image which triggers the reload | `docker.io` |
Expand Down
6 changes: 6 additions & 0 deletions charts/jenkins/templates/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ data:
# remove all plugins from shared volume
rm -rf {{ .Values.controller.jenkinsHome }}/plugins/*
{{- end }}
{{- if .Values.controller.JCasC.overwriteConfiguration }}
echo "deleting all XML config files"
rm -f {{ .Values.controller.jenkinsHome }}/config.xml
rm -f {{ .Values.controller.jenkinsHome }}/*plugins*.xml
find {{ .Values.controller.jenkinsHome }} -maxdepth 1 -type f -iname '*configuration*.xml' -exec rm -f {} \;
{{- end }}
{{- if .Values.controller.installPlugins }}
echo "download plugins"
# Install missing plugins
Expand Down
2 changes: 2 additions & 0 deletions charts/jenkins/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,8 @@ controller:
# etc. Best reference is https://<jenkins_url>/configuration-as-code/reference. The example below creates a welcome message:
JCasC:
defaultConfig: true
# If true, the init container deletes all the plugin config files and Jenkins Config as Code overwrites any existing configuration
overwriteConfiguration: false
configUrls: []
# - https://acme.org/jenkins.yaml
# Remote URL:s for configuration files.
Expand Down

0 comments on commit 1cac0ec

Please sign in to comment.