sue445 / jenkins-backup-script Goto Github PK
View Code? Open in Web Editor NEWarchive jenkins setting and plugins
Home Page: http://sue445.hatenablog.com/entry/2013/12/08/005317
License: MIT License
archive jenkins setting and plugins
Home Page: http://sue445.hatenablog.com/entry/2013/12/08/005317
License: MIT License
I don't know whether I may use and customize this freely.
Failed on line: 43
SouceFile missing
Hi, is there a way to exclude stuff from the backup ? Like jobs etc ? I'm only interested in restoring the jenkins config and plugins to another server but no jobs
Thanks
I'm using Jenkins build 1608 and the script 0.1.0. It ran with the error below:
...
認証情報が入ってますので
I used the script from /root
with the command ./jenkins-backup-script/ /var/lib/jenkins archive.tar.gz
. I expected to now have a file called /root/archive.tar.gz
.
However the console prints
+ mv -f /root/jenkins-backup-script/tmp/archive.tar.gz archive.tar.gz
mv: '/root/jenkins-backup-script/tmp/archive.tar.gz' and 'archive.tar.gz' are the same file
and my backup is in /root/jenkins-backup-script/tmp/archive.tar.gz
Provide example restore commands, mention that jenkins must be stopped if needed.
The title says it all. You can't cd to the jobs folder when it hasn't been created yet since the folder is new and hasn't had any jobs added yet.
Here's how it can be fixed:
In backup-jenkins.sh line 51 says
cd "$run_in_path"
Add this line before it and a corresponding "fi" after the "done"
if [ -d "$run_in_path" ] ; then
I know, I'm being lazy and not submitting a patch. Sorry. Never done that on GitHub before and don't want to learn for a single line. Someday ...
Structure in $JENKINS_HOME/jobs
:
$ tree -d .
.
├── github_org
│ └── jobs
│ ├── gh_job_a
│ └── gh_job_b
└── regular_folder
└── jobs
├── job_a
└── job_b
Structure after unpacking backup:
$ tree -d .
.
├── github_org
└── regular_folder
└── jobs
├── job_a
└── job_b
Hi, what about secrets folder? Not sure if relevant but I've seen other guys doing backup for that also (http://www.clausconrad.com/blog/backup-jenkins-configuration-to-s3).
-bash-4.1$ ./jenkins-backup.sh /var/lib/jenkins archive20140329.tar.gz
mkdir: cannot create directory /opt/jenkins_jobs/backup_job/tmp/jenkins-backup': No such file or directory mkdir: cannot create directory
/opt/jenkins_jobs/backup_job/tmp/jenkins-backup/plugins': No such file or directory
mkdir: cannot create directory `/opt/jenkins_jobs/backup_job/tmp/jenkins-backup/jobs': No such file or directory
Build fails since nodes/ dir is empty:
Output:
+ '[' -d /var/jenkins_home/nodes/ ']'
+ cp -R '/var/jenkins_home/nodes/*' '/var/jenkins_home/jobs/Backups - Daily Job/workspace/tmp/jenkins-backup/nodes'
cp: cannot stat ‘/var/jenkins_home/nodes/*’: No such file or directory
Build step 'Execute shell' marked build as failure
[ExclusiveBuildWrapper] Canceling Jenkins shutdown mode...
Finished: FAILURE
You could use an extra conditional to prevent this from happening if dir is empty (http://www.cyberciti.biz/faq/linux-unix-shell-check-if-directory-empty/), like:
if [ "$(ls -A $DIR)" ]; then
For example
A job in jenkins:
.../jenkins/workspace/Folder1/User1/TestJob/config.xml
After backup, the path will be:
/jenkins-backup/jobs/Folder1/jobs/User1/jobs/TestJob/config.xml
need to mention in guideline, the job shall be run in master server to access those configuration
This script may happen to have an Error with line 31
./jenkins-backup.sh: line 31: [: 引数が多すぎます
Maybe this ocurre by
if [ -f "$JENKINS_HOME/plugins/".hpi.pinned -o -f "$JENKINS_HOME/plugins/".jpi.pinned ] ; then
"$JENKINS_HOME/plugins/"*.jpi.pinned
this wild card line will extract many file list.
Like this:
"-o -f /var/lib/jenkins//plugins/ant.jpi.pinned /var/lib/jenkins//plugins/antisamy-markup-formatter.jpi.pinned /var/lib/jenkins//plugins/credentials.jpi.pinned /var/lib/jenkins//plugins/cvs.jpi.pinned /var/lib/jenkins//plugins/javadoc.jpi.pinned /var/lib/jenkins//plugins/junit.jpi.pinned /var/lib/jenkins//plugins/ldap.jpi.pinned /var/lib/jenkins//plugins/mailer.jpi.pinned /var/lib/jenkins//plugins/matrix-auth.jpi.pinned /var/lib/jenkins//plugins/matrix-project.jpi.pinned /var/lib/jenkins//plugins/maven-plugin.jpi.pinned /var/lib/jenkins//plugins/pam-auth.jpi.pinned /var/lib/jenkins//plugins/ssh-slaves.jpi.pinned /var/lib/jenkins//plugins/subversion.jpi.pinned /var/lib/jenkins//plugins/translation.jpi.pinned ']'"
to fix this. (just idea)
readonly hpi.pinned_count=$(find $JENKINS_HOME/plugins/ -name *.jhi.pinned | wc -l)
readonly jpi.pinned_count=$(find $JENKINS_HOME/plugins/ -name *.jpi.pinned | wc -l)
if [ $hpi.pinned_count -ne 0 -o jpi.pinned_count -ne 0 ]; then
よろしくお願いします。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.