helm-charts
helm-charts copied to clipboard
Persist job folder only
Is your feature request related to a problem? Please describe. I would like my jenkins to persist the $JENKINS_HOME/jobs folder, so I can bake everything else into a base image (ie: all my credentials, plugins ...etc would be baked into a docker image). That way, I can get:
- a fast start of jenkins (no initialization needed)
- I can even avoid version controlling the plugins: just bake the latest version, and if it fails, use a previous image.
- any changes done manually will be wiped clean (like installing a new plugin or adding a new credential or whatever ...)
Describe the solution you'd like In essence, we could maybe just add an option here: https://github.com/jenkinsci/helm-charts/blob/main/charts/jenkins/templates/jenkins-controller-statefulset.yaml#L120 , something like:
volumeMounts:
{{- if .Values.controller.persistJobsOnly }}
- mountPath: {{ .Values.controller.jenkinsHome }}/jobs
{{- else }}
- mountPath: {{ .Values.controller.jenkinsHome }}
{{- end }}
name: jenkins-home
and then add that option "controller.persistJobsOnly" as a false value by default in values.yaml
Describe alternatives you've considered The only other solution I can think of (disclaimer: I'm just starting with this helm chart) would be to modify the init script to wipe off the jenkins home folder except jobs folder, and copy back from the baked image. But that's ugly, and can't even be done easily since the init script does not have a "insert custom script here" (might be a nice to have too ?)
Additional context I know it can be done for the plugins folder by having the plugins in the image in jenkinsRef folder, and playing with the controller.overwritePlugins and controller.installPlugins variables - but that's only for plugins: I'd like to have that simple new option so that we only persist the jobs folder, and nothing else.
I hope I'm clear enough and that it's not a silly request ;)
Quick update: I actually found out I can accomplish what I need by:
- setting persistence.enabled to false
- creating myself the mounts:
persistence.volumes:
- name: jenkins-jobs
persistentVolumeClaim:
claimName: myclaim
persistence.mounts:
- name: jenkins-jobs
mountPath: /var/jenkins_home/jobs
# and for "complete-ish" documentation, those flags are needed as well to use the plugins from the image
controller.installPlugins = []
controller.overwritePluginsFromImage = ""
controller.overwritePlugins = true
So technically, that means this ticket could be closed - but this feels like a workaround/hack, while my proposition would make it a bit cleaner, I think => keeping it open for now
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Any further update will cause the issue/pull request to no longer be considered stale. Thank you for your contributions.
This functionality would be helpful and goes hand-in-hand with overall recommendation to manage all configurations as code and to create custom image with your plugins. Other than the build logs and job stats, we don't really care about the rest of the files.
@jgournet out of curiosity, is there any particular reason why you set controller.overwritePluginsFromImage
that way instead of using false
?
@pashcan : "yes", there is a reason ... but I kind of forgot :/ So, from bad memory: using false gets me a helm templating error (sorry, that's not super helpful, and we stopped the project, so I can't try again anymore without resurrecting the whole thing :) )
@jgournet No worries whatsoever! There are so many permutations with different versions of the helm chart and how built-in templates parse and apply certain values... I'll take any insight on what had worked in the past :stuck_out_tongue_closed_eyes: I appreciate you taking the time to reply :pray:
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Any further update will cause the issue/pull request to no longer be considered stale. Thank you for your contributions.
This would still be useful => not stale
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Any further update will cause the issue/pull request to no longer be considered stale. Thank you for your contributions.