thinBackup

Skip to end of metadata
Go to start of metadata

Plugin Information

Plugin ID thinBackup Changes In Latest Release
Since Latest Release
Latest Release
Latest Release Date
Required Core
Dependencies
1.7.4 (archives)
Oct 14, 2013
1.509
Source Code
Issue Tracking
Maintainer(s)
GitHub
Open Issues
Thomas Fuerer (id: tofuatjava)
Matthias Steinkogler (id: alienllama)
Usage Installations 2014-Apr 5829
2014-May 6059
2014-Jun 6210
2014-Jul 6587
2014-Aug 6671
2014-Sep 7096
2014-Oct 7393
2014-Nov 7528
2014-Dec 7608
2015-Jan 8046
2015-Feb 8192
2015-Mar 8743

This plugin simply backs up the global and job specific configurations (not the archive or the workspace).

Compatibility

This plugin needs Hudson 1.377 (1.409 or greater recommended) or newer for automated backups (manual backups also work in older versions).

Why another backup plugin

The Backup Plugin only does manual backups, and stores all data found in JENKINS_HOME. This is sometimes (e.g. big Jenkins environment) not practical because of time and disk space requirements, and because it can only be manually triggered. thinBackups can be scheduled and only backs up the most vital configuration info.

Documentation

This plugin adds another management link to 'Manage Hudson' called ThinBackup which looks like this:

This new link provides the following actions:

Backup Now

Triggers a manual full back up right now.

Restore


Select the date of the backup you would like to restore. After the restore finishes you are redirected to the plugin main page. To activate the restored settings you need to restart jenkins.

Note: The file 'nextBuildnumber' will not be backed up or restored to prevent buildnumber collision by default. The archive and the workspace will not be deleted or changed, but all backed up files will simply be overwritten with the restored versions (e.g. config.xml, thinBackup.xml -> for more info simply look in a backup).

.

Restore next build number file (if found in backup)

If this option is enabled, the file nextBuildNumber will also be restored.
*Note:*Take special care when restoring a backup that contains a nextBuildNumber file, as this may potentially cause a lot of problems.

Restore plugins

If this option is enabled, the plugins get restored. You need an active internet connection to the update server, because plugins will be downloaded from the update server to keep the backup small.

Settings

Backup directory

Specify the backup directory. The Jenkins process needs write access to this directory. You can use environment variables like ${JENKINS_WORKSPACE} to specify the path.

Backup schedule for full backups

Specify schedule when a full backup is triggered. Cron notation is used. A full backup backs up all files even if there were no changes.

Backup schedule for differential backups

Specify schedule when a differential backup is triggered. Cron notation is used. A differential backup stores only modified data since the last full backup. If there are no changes detected, no diff backup will be created.

Note: You do not need to specify a differential backup schedule if you only need full backups. Because differential backups depend on full backups, a schedule for full backups is mandatory if you specify a differential backup schedule.

Wait until Jenkins/Hudson is idle to perform a backup

It is very recommended to enable this option (default). Nevertheless, many users report that the quiet mode is blocking the execution of long running jobs. If you disable this option the backup will be made without waiting for a safe state of your instance. In other words, the backup will be done immediately, and this could cause corrupt backups.

Force Jenkins to quite mode after specified minutes

Force a quiet mode after the specified time in minutes to force a safe environment for the back up. Zero means the quite mode is forced directly when the back up is triggered by the scheduler. Read more about the back up process below.

Max number of backup sets

To save disk space, you can specify the maximum number of stored backup sets. A backup set is defined as a full backup together with its referencing diff backups. Older backup sets will be deleted after the next full backup action. This also applies to zipped backup sets.

Files excluded from backup

If you have specific files you do not want to back up, entering a regex here which identifies those files will prevent them being backed up. All files with a name matching this regular expression will not be backed up. Leave empty if not needed. If the expression is invalid, it will be disregarded.

Back up build results

If this option is enabled, build results will also be backed up. This is potentially a lot of data, so think carefully about it. Once you decide to backup build results you get also to option about backup your build archives. Once again, be careful with this option, because it could be very time consuming and needs probably a lot of disk space!

Back up 'userContents'

Jenkins provides a URL where you can put common data (e.g. static HTML, Tools, ...). you can back up all these data if you check this option.

Backup only builds marked to keep

If this option is enabled, only builds results/artifacts on builds which are marked "Keep this build forever" are backed up.

Clean up differential backups

If this option is enabled, all differential backups are removed whenever a new full backup is done.

Move old backups to ZIP files

If this is checked, then whenever a new full backup is performed all old backup sets will be moved to ZIP files. Each ZIP file will contain one backup set, i.e. one full backup and any diff backups referencing it. The file name will identify the time frame where the backups are included (i.e. the time stamp of the full backup and the time stamp of the latest diff backup).

Note: The setting "Max number of backup sets" applies to backup ZIP files created by thinBackup as well.

Note: In case "Clean up differential backups" is checked, diff cleanup will be performed before zipping is done, and therefore no diff backups will be in the ZIP files.

Back up process

Because many of you are asking why Jenkins is going to shutdown when a back up is triggered, I decided to explain my ideas behind the back up process.
First of all, Jenkins will not be shut down at any time.
Second, I use the build-in quiet mode (Jenkins is going to shutdown) to ensure a safe environment during the back up process and cancel the quiet mode afterwards. This could be misleading, I know, but there is no point where Jenkins will be shutdown.

So what is a safe environment?
A safe environment would mean that no jobs are running. Because a running job could change a file in the workspace (results, build output, ...), in this case the file could be locked. This situation should be avoided by using the quiet mode.

How it works, an example:

  • The scheduler triggers a backup
  • There are active jobs and some jobs are waiting in the queue
  • The back up waits for a safe environment (recommended way). This means running jobs will be finished in any case. Waiting jobs will be started as long Jenkins is not in the quiet mode. The 'Force Jenkins to quite mode after specified minutes' option will force Jenkins after the specified time into the quiet mode. From this point on no further jobs will be started until the backup is finished.
    In case of 'Wait until Jenkins/Hudson is idle to perform a backup' is disabled the backup will be done immediately.
  • The back up starts when no job is running.
  • Once the back up is finished the quiet mode will be canceled. Manually canceling the quiet mode will force a new quiet period.

Changelog

Version Comment
1.7.4
fixed issued: JENKINS-20026
1.7.3 fixed issues: JENKINS-17475
Upgrade Jenkins core version to 1.509, verions before this are not tested and midge be buggy.
1.7.2 fixed issues: JENKINS-16426 (-> JENKINS-16897 )
improvements: JENKINS-16609
1.7.1 defect artifact - Please do not use!
1.7 new features: JENKINS-10947: Plug-ins will be restored from the update server
improvements:JENKINS-15681: Support for Cloudbees Folders
fixed issues: JENKINS-15514
1.6.2
fixed issues: JENKINS-14288, JENKINS-12173, JENKINS-12098
1.6.1
fixed issues: JENKINS-14111, JENKINS-13980
1.6
fixed issues: JENKINS-13427
improvements: JENKINS-13059
1.5
fixed issues:
improvements: JENKINS-8565; JENKINS-11062; JENKINS-11678; JENKINS-11975
new features: JENKINS-10994
1.4 fixed issues: JENKINS-10377; JENKINS-10381
1.3 fixed issues: JENKINS-9117;JENKINS-8955;JENKINS-9171;JENKINS-9669
new features: Compress old backupsets; exclude files from backup via regex
1.2 fixed issues: JENKINS-8782;JENKINS-8781; JENKINS-8606;JENKINS-8564
JENKINS-8583 will be fixed if you use Jenkins greater or equal 1.396
1.1 first published version
1.0 never published because of release problems

Feature Requests

Please let us know if you would have another option or feature for this plugin by simply enter an issue or write us an email. THANKS

Labels

plugin-misc plugin-misc Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. May 26, 2011

    hbockelmann - says:

    I have ThinBackup plugin version 1.2 installed on jenkins 1.411 running on CentO...

    I have ThinBackup plugin version 1.2 installed on jenkins 1.411 running on CentOS 5.6

    Leaving "schedule for full backups" and "schedule for differential backups" empty gives the log output:

    May 26, 2011 9:35:35 AM hudson.model.AsyncPeriodicWork$1 run
    INFO: Started ThinBackup Worker Thread
    May 26, 2011 9:35:35 AM hudson.model.AsyncPeriodicWork$1 run
    INFO: Finished ThinBackup Worker Thread. 0 ms

    every minute ...

    But setting the schedule to "0 12 * * 7" for full and to "0 12 * * *" for differential backups, results in the log output:

    May 26, 2011 9:47:35 AM hudson.model.AsyncPeriodicWork$1 run
    INFO: Started ThinBackup Worker Thread
    May 26, 2011 9:47:35 AM org.jvnet.hudson.plugins.thinbackup.ThinBackupPeriodicWork calculateDelay
    SEVERE: Delay is a negative number, which means the next execution is in the past! Something bad happened.
    Exception in thread "ThinBackup Worker Thread thread" java.lang.IllegalStateException: Delay is a negative number, which means the next execution is in the past! Something bad happened.
            at org.jvnet.hudson.plugins.thinbackup.ThinBackupPeriodicWork.calculateDelay(ThinBackupPeriodicWork.java:147)
            at org.jvnet.hudson.plugins.thinbackup.ThinBackupPeriodicWork.getNextScheduledBackup(ThinBackupPeriodicWork.java:104)
            at org.jvnet.hudson.plugins.thinbackup.ThinBackupPeriodicWork.execute(ThinBackupPeriodicWork.java:65)
            at hudson.model.AsyncPeriodicWork$1.run(AsyncPeriodicWork.java:51)
            at java.lang.Thread.run(Thread.java:636)

    What happens here?

  2. Jun 09, 2011

    Frank Schophuizen says:

    Just an idea... Maybe you should use 0 for Sunday instead of 7. BTW, I also see...

    Just an idea... Maybe you should use 0 for Sunday instead of 7.

    BTW, I also see the logging of starting and finishing the ThinBackup Worker Thread. I wonder why should it be started every minute, if the backup is scheduled once a day?

    6-jun-2011 19:18:56 hudson.model.AsyncPeriodicWork$1 run
    INFO: Started ThinBackup Worker Thread
    6-jun-2011 19:18:56 hudson.model.AsyncPeriodicWork$1 run
    INFO: Finished ThinBackup Worker Thread. 0 ms

    1. Jun 10, 2011

      BB Tksh says:

      +1 Every minute loggings are very annoying. At least for us, every hour log...

      +1

      Every minute loggings are very annoying.
      At least for us, every hour log is enough ...

    2. Jul 04, 2011

      Thomas Fuerer says:

      fist of all; sorry i didn't see your comments on this page because I visit this ...

      fist of all; sorry i didn't see your comments on this page because I visit this page not very often.
      PLEASE give us feedback only via JIRA or e-mail if you need a quick or reliable answer.

      second: The problem with the logging is an internal problem of jenkins, because the scheduler logs every time it will be called. I need to call this every minute because the the interval of CRON is at least one minute. I asked the core team if we could change the log level of this log statement but I get no response.
      So for the next release I duplicated the code and remove the log statement -> so no more annoying logs.

      third: thank you for using thinBackup ;-)

  3. Dec 20, 2011

    Adil Akhund-Zade says:

    Does not save build results for matrix projects.

    Does not save build results for matrix projects.

  4. Jul 02, 2012

    Mike Petterson says:

    Hi, As I understand you can  do a scheduled backup. Suppose that I have an...

    Hi,

    As I understand you can  do a scheduled backup. Suppose that I have another instance of jenkins ( dev server) running somewhere else ( also with your nice plugin installed). If I check the backup directory and find a new version of backup data can I from CLI do restore of this new version into my dev server ( just to make sure we keep it up-to-date).

    br,

    //mike

  5. Aug 13, 2012

    rsaddey - says:

    Not really an issue, but just-in-case you're still using Java 5: thinBackup requ...

    Not really an issue, but just-in-case you're still using Java 5: thinBackup requires Java 6.

    See JENKINS-13874 - java.lang.NoSuchMethodError: java/lang/String.isEmpty()Z

  6. Oct 05, 2012

    Gerald Bringhurst says:

    I don't think this was a well thought out plugin: As soon as you kick off a 'th...

    I don't think this was a well thought out plugin:

    As soon as you kick off a 'thinbackup', you cannot start any new jobs, and it won't back ANYTHING up, until ALL of the currently running jobs are done.

    So, if I am on day two of a four day test, no jobs will start and run for two days!  oops!   and you CANNOT cancel the backup!

    How about, 'thinbackup' tags the xml/configurations it cannot backup (i.e. jobs that are running), and back them up as soon as the are free.

    Otherwise in order to get jenkins back to a point where jobs can be triggered and run, you need to restart the service, and lose days of testing or build data.

    1. Nov 06, 2012

      Thomas Fuerer says:

      Hi, If you do not like to wait for what I called secure environment, you can ju...

      Hi,

      If you do not like to wait for what I called secure environment, you can just disable this by uncheck "Wait until Jenkins/Hudson is idle to perform a backup".

      Yes, for now it is not possible to cancle the backup, but I never needed it until today because my backup is running overnight and takes only a view minutes. I suggest to add an issue to JIRA and I or some one else will add it as a new feature. Also the other idea be marking "unsafe" jobs and skip it or do the backup later would be an interessting alternative way to work around the problem. Once again my first goal was to insure a complete and safe backup, because incomplete backups will not help very well in case of an desaster.

      If you don't think that this plugin will not work for you, you have some options:

      • just don't use it
      • improve it by joining us as a programmer
      • let us know what you want by adding another issue to JIRA

      Blaming us will not help us very well, and of course this plugin is not perfect. I have many ideas but less time, and basically it works for me and a lot of other peoples. We will work to steady improve this plugin because I do not want to loose my setup again because of a hardware defect.

      thomas

  7. Oct 31, 2012

    Ruben Perez says:

    It doesn't have support for Cloudbees Folders.... It's not backup up the jobs in...

    It doesn't have support for Cloudbees Folders.... It's not backup up the jobs inside.... Big downside....

  8. Dec 20, 2012

    Barrett Strausser says:

    The scheduled backup is not working for me. I can run the backup manually so I k...

    The scheduled backup is not working for me. I can run the backup manually so I know it isn't a permissions issue. It appears not to run at all at the scheduled times. I have ensured no jobs were running during the scheduled times.

    Where should I look in the logs for more information.

  9. Jul 15, 2013

    Josuha Henn says:

    Getting the follow exception, looks like its failing when source directory doesn...

    Getting the follow exception, looks like its failing when source directory doesn't exist.

    SEVERE: Cannot perform a backup. Please be sure jenkins/hudson has write privileges in the configured backup path '/tmp/jenkins-backup'.
    java.io.FileNotFoundException: Source '/var/lib/jenkins/jobs/backup - offsite/builds/lastSuccessfulBuild' does not exist
    at org.apache.commons.io.FileUtils.copyDirectory(FileUtils.java:866)
    at org.apache.commons.io.FileUtils.copyDirectory(FileUtils.java:814)
    at org.jvnet.hudson.plugins.thinbackup.backup.HudsonBackup.backupBuildFiles(HudsonBackup.java:302)
    at org.jvnet.hudson.plugins.thinbackup.backup.HudsonBackup.backupBuildsFor(HudsonBackup.java:270)
    at org.jvnet.hudson.plugins.thinbackup.backup.HudsonBackup.backupJob(HudsonBackup.java:208)
    at org.jvnet.hudson.plugins.thinbackup.backup.HudsonBackup.backupJobsDirectory(HudsonBackup.java:196)
    at org.jvnet.hudson.plugins.thinbackup.backup.HudsonBackup.backupJobs(HudsonBackup.java:175)
    at org.jvnet.hudson.plugins.thinbackup.backup.HudsonBackup.backup(HudsonBackup.java:142)
    at org.jvnet.hudson.plugins.thinbackup.ThinBackupPeriodicWork.backupNow(ThinBackupPeriodicWork.java:87)
    at org.jvnet.hudson.plugins.thinbackup.ThinBackupMgmtLink$1.execute(ThinBackupMgmtLink.java:76)
    at org.jvnet.hudson.plugins.thinbackup.hudson.model.AsyncPeriodicWork$1.run(AsyncPeriodicWork.java:54)
    at java.lang.Thread.run(Thread.java:679)

  10. Aug 12, 2013

    Ming Ho says:

    Has anybody seen this?  some of my jobs' "lastFailedBuild" point to "-1" si...

    Has anybody seen this?  some of my jobs' "lastFailedBuild" point to "-1" since they have never failed or failed builds no longer exist.

    Aug 12, 2013 11:27:47 AM org.jvnet.hudson.plugins.thinbackup.ThinBackupPeriodicWork backupNow
    SEVERE: Cannot perform a backup. Please be sure jenkins/hudson has write privileges in the configured backup path '/storage/backups'.
    java.io.FileNotFoundException: Source '/storage/jenkins/jobs/Remix_3.x/builds/lastFailedBuild' does not exist
            at org.apache.commons.io.FileUtils.copyDirectory(FileUtils.java:866)
            at org.apache.commons.io.FileUtils.copyDirectory(FileUtils.java:814)
            at org.jvnet.hudson.plugins.thinbackup.backup.HudsonBackup.backupBuildFiles(HudsonBackup.java:302)
            at org.jvnet.hudson.plugins.thinbackup.backup.HudsonBackup.backupBuildsFor(HudsonBackup.java:270)
            at org.jvnet.hudson.plugins.thinbackup.backup.HudsonBackup.backupJob(HudsonBackup.java:208)
            at org.jvnet.hudson.plugins.thinbackup.backup.HudsonBackup.backupJobsDirectory(HudsonBackup.java:196)
            at org.jvnet.hudson.plugins.thinbackup.backup.HudsonBackup.backupJobs(HudsonBackup.java:175)
            at org.jvnet.hudson.plugins.thinbackup.backup.HudsonBackup.backup(HudsonBackup.java:142)
            at org.jvnet.hudson.plugins.thinbackup.ThinBackupPeriodicWork.backupNow(ThinBackupPeriodicWork.java:87)
            at org.jvnet.hudson.plugins.thinbackup.ThinBackupMgmtLink$1.execute(ThinBackupMgmtLink.java:76)
            at org.jvnet.hudson.plugins.thinbackup.hudson.model.AsyncPeriodicWork$1.run(AsyncPeriodicWork.java:54)
            at java.lang.Thread.run(Thread.java:636)