I was trying to create a Jenkins master slave system using Helm Charts. [ https://github.com/jenkinsci/helm-charts/blob/main/charts/jenkins/README.md ].
After deploying I can see the plugins are stored in two locations in the pod/ docker container.
1. /var/jenkins_home/plugins
2. /usr/share/jenkins/ref/plugins
What's the relation between these two? JENKINS_HOME is configured as /var/jenkins_home/
. If I need to backup the plugins which directory should I backup ?
For a plugin named ace-editor
, I can see these many files in respective folders.
/usr/share/jenkins/ref/plugins
contains (1 file) -> ace-editor.jpi
/var/jenkins_home/plugins
contains (4 file) -> ace-editor.jpi, ace-editor.jpi, ace-editor.jpi.pinned, ace-editor.jpi.version_from_image
What does this mean?
The directory to back up is always /var/jenkins_home
. It is meant to be a persistent volume with all the data. /var/jenkins_home/plugins
contains the downloaded .jpi
plugin files and directories where each plugin has been unpacked.
The directory /usr/share/jenkins/ref
is a "reference" directory on the container image. This means /usr/share/jenkins/ref/plugins
is used as a starting point to install a base set of plugins into /var/jenkins_home/plugins
the first time you run Jenkins.
The log file containing info about installed reference files is /var/jenkins_home/copy_reference_file.log
.
The files with suffix .pinned
or .version_from_image
are used to control subsequent behaviour for example when plugins have been updated in jenkins_home
from the UI and/or to the reference directory in a newer container image. Some users might want to use the bundled plugins in the image only for initial startup, others as the definitive source of all updates. See also environmental variables described in the documentation.
If you want to examine the inner workings you can find shell script jenkins.sh
and functions source jenkins-support
in the repository root or in /usr/local/bin
on the image.