Skip to content

Commit

Permalink
Merge pull request #251 from sonjek/master
Browse files Browse the repository at this point in the history
Backup jks files
  • Loading branch information
sue445 authored Apr 27, 2024
2 parents 22cd19b + 4d6713b commit 37f000c
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Archive Jenkins settings and plugins

* `$JENKINS_HOME/*.xml`
* `$JENKINS_HOME/*.jks`
* `$JENKINS_HOME/jobs/*/*.xml`
* `$JENKINS_HOME/nodes/*`
* `$JENKINS_HOME/plugins/*.jpi`
Expand Down
5 changes: 5 additions & 0 deletions jenkins-backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ function main() {

cp "${JENKINS_HOME}/"*.xml "${ARC_DIR}"

jks_count=$(find ${JENKINS_HOME} -maxdepth 1 -type f -name *.jks | wc -l)
if [ ${jks_count} -ne 0 ]; then
cp "${JENKINS_HOME}/"*.jks "${ARC_DIR}/"
fi

cp "${JENKINS_HOME}/plugins/"*.[hj]pi "${ARC_DIR}/plugins"
hpi_pinned_count=$(find ${JENKINS_HOME}/plugins/ -name *.hpi.pinned | wc -l)
jpi_pinned_count=$(find ${JENKINS_HOME}/plugins/ -name *.jpi.pinned | wc -l)
Expand Down
1 change: 1 addition & 0 deletions spec/jenkins-backup_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"jenkins-backup/users/",
"jenkins-backup/users/sue445/",
"jenkins-backup/users/sue445/config.xml",
"jenkins-backup/saml-jenkins-keystore.jks",
]

describe tar_file("/tmp/relative_archive.tar.gz") do
Expand Down
1 change: 1 addition & 0 deletions spec/recipes/jenkins/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

%w(
hudson.model.UpdateCenter.xml
saml-jenkins-keystore.jks
).each do |file|
remote_file "#{node[:jenkins_home]}/#{file}" do
mode "644"
Expand Down
Empty file.
Empty file.

0 comments on commit 37f000c

Please sign in to comment.