[stable/jenkins] Add support for initializing Jenkins master only once (#23378)

* Add support for initializing Jenkins master only once.

Signed-off-by: Adeel Hasan Akbari <adeel.akbari@gmail.com>

* Enhance documentation to highlight dependence on `persistence.enabled`

Signed-off-by: Adeel Hasan Akbari <adeel.akbari@gmail.com>

* Bump chart version to 2.5.0

Signed-off-by: Adeel Hasan Akbari <adeel.akbari@gmail.com>

* Bump chart version to 2.5.0

Signed-off-by: Adeel Hasan Akbari <adeel.akbari@gmail.com>
This commit is contained in:
Adeel Hasan Akbari
2020-08-02 04:59:40 -07:00
committed by GitHub
parent fb9f2c4f98
commit 71d46a3af6
5 changed files with 21 additions and 2 deletions
+4
View File
@@ -5,6 +5,10 @@ numbering uses [semantic versioning](http://semver.org).
NOTE: The change log until version 1.5.7 is auto generated based on git commits. Those include a reference to the git commit to be able to get more details.
## 2.5.0
Add an option to specify that Jenkins master should be initialized only once, during first install.
## 2.4.1
Reorder README parameters into sections to facilitate chart usage and maintenance
+1 -1
View File
@@ -1,7 +1,7 @@
apiVersion: v1
name: jenkins
home: https://jenkins.io/
version: 2.4.1
version: 2.5.0
appVersion: lts
description: Open source continuous integration server. It supports multiple SCM tools
including CVS, Subversion and Git. It can execute Apache Ant and Apache Maven-based
+2 -1
View File
@@ -68,7 +68,7 @@ master:
#### Migration steps
Migration instructions heavily depend on your current setup.
So think of the list below more as a general guideline of what should be done.
So think of the list below more as a general guideline of what should be done.
- Ensure that the Jenkins image you are using contains a user with id 1000 and a group with the same id.
That's the case for `jenkins/jenkins:lts` image, which the chart uses by default
@@ -191,6 +191,7 @@ The following tables list the configurable parameters of the Jenkins chart and t
| --------------------------------- | ------------------------------------ | ----------------------------------------- |
| `master.installPlugins` | List of Jenkins plugins to install. If you don't want to install plugins set it to `[]` | `kubernetes:1.18.2 workflow-aggregator:2.6 credentials-binding:1.19 git:3.11.0 workflow-job:2.33` |
| `master.additionalPlugins` | List of Jenkins plugins to install in addition to those listed in master.installPlugins | `[]` |
| `master.initializeOnce` | Initialize only on first install. Ensures plugins do not get updated inadvertently. Requires `persistence.enabled` to be set to `true`. | `false` |
| `master.overwritePlugins` | Overwrite installed plugins on start.| `false` |
| `master.overwritePluginsFromImage` | Keep plugins that are already installed in the master image.| `true` |
+9
View File
@@ -159,6 +159,12 @@ data:
</jenkins.CLI>
{{- end }}
apply_config.sh: |-
{{- if .Values.master.initializeOnce }}
if [ -f {{ .Values.master.jenkinsHome }}/initialization-completed ]; then
echo "master was previously initialized, refusing to re-initialize"
exit 0
fi
{{- end }}
echo "applying Jenkins configuration"
mkdir -p {{ .Values.master.jenkinsRef }}/secrets/;
{{- if .Values.master.enableXmlConfig }}
@@ -253,6 +259,9 @@ data:
yes n | cp -i /var/jenkins_secrets/* {{ .Values.master.jenkinsRef }}/secrets/;
{{- end }}
echo "finished initialization"
{{- if .Values.master.initializeOnce }}
touch {{ .Values.master.jenkinsHome }}/initialization-completed
{{- end }}
{{- range $key, $val := .Values.master.initScripts }}
init{{ $key }}.groovy: |-
{{ $val | indent 4 }}
+5
View File
@@ -235,6 +235,11 @@ master:
# List of plugins to install in addition to those listed in master.installPlugins
additionalPlugins: []
# Enable to initialize the Jenkins master only once on initial installation.
# Without this, whenever the master gets restarted (Evicted, etc.) it will fetch plugin updates which has the potential to cause breakage.
# Note that for this to work, `persistence.enabled` needs to be set to `true`
initializeOnce: false
# Enable to always override the installed plugins with the values of 'master.installPlugins' on upgrade or redeployment.
# overwritePlugins: true