Git Product home page Git Product logo

jenkins-backup-script's People

Contributors

banyan avatar dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar fredrikand avatar jackleo avatar jgeiger avatar jonniedarko avatar kakkun61 avatar maafy6 avatar namikawa avatar rahuldshetty avatar rluisr avatar rubenjgarcia avatar sarg avatar sejeff avatar sonjek avatar sue445 avatar toru81 avatar wukann avatar ynott avatar yonex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jenkins-backup-script's Issues

cp failed source file dose not exist.

  • mkdir -p /root/backup/tmp/jenkins-backup/jobs/XXXX-pull/
  • cp '/var/lib/jenkins/jobs/dphelp-pull/.xml' /root/backup/tmp/jenkins-backup/jobs/XXXX-pull/
    cp: cannot stat `/var/lib/jenkins/jobs/XXXX-pull/
    .xml': そのようなファイルやディレクトリはありません

Failed on line: 43
SouceFile missing

Exclude elements

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

cp: cannot stat `/path/to/jenkins/users/*': No such file or directory

I'm using Jenkins build 1608 and the script 0.1.0. It ran with the error below:
...

  • cp -R '/home/TaiTT/apg/jenkins/users/' '/home/TaiTT/apg/jenkins/workspace/Jenkins Weekly Backup/tmp/jenkins-backup/users'
    cp: cannot stat `/home/TaiTT/apg/jenkins/users/
    ': No such file or directory
    Build step 'Execute shell' marked build as failure
    [ExclusiveBuildWrapper] Canceling Jenkins shutdown mode...
    Finished: FAILURE

Wrong place for backup

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

Script fails when a folder exists with no jobs in it

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 ...

Script does not back-up jobs in GitHub or Bitbucket organization

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

ubuntu : mkdir: cannot create directory `/opt/jenkins_jobs/backup_job/tmp/jenkins-backup': No such file or directory

error like this:

-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

I think should use "mkdir -p" instead of "mkdir"

Nodes directory is empty

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 jobs in folder, the backup is not correct

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

Error ocurred at line 31 [ too many arguments]

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

よろしくお願いします。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.