Is there (an automated) way to backup Hudson CI fi

2019-03-16 06:37发布

问题:

Here at my company we have three Hudson CI servers with 100+ jobs configured. We are looking for an automated way to periodically backup job configurations and build history.

Currently we have an ant script that we configure as a job but it's not easy to maintain and not elegant.

Have any of you found a way to manage this?

回答1:

There is a Backup Plugin.

I don't believe that it supports scheduling of periodic backups, but you might be able to trigger it by accessing it through the URL (like some other Hudson remote APIs), in which case you might be able to simply set up a cron job to ping the URL.



回答2:

My Hudson servers run on windows, so I use Robocopy for this. I have it mirror all files in each build server's hudson home, excluding job workspace directories. Since the backups are going to a central place, I have a scheduled task on a fileserver that runs my script nightly, and the Hudson servers are unaware of the process.

The script has one entry per hudson machine:

robocopy path-to-buildserver-hudson-home backup-folder-path\buildserver-name /ZB /E /NP /R:1 /W:5 "/LOG:%~dp0backup_log.txt" /TEE /XD workspace

Note: after the first machine, it becomes /LOG+: instead of /LOG: so that the next ones append to the log.

This mirrors without deleting files that don't exist in source, so even if Hudson is setup to delete build results after X months or Y builds, the backups could still have the full history...as well as logs to console and a file, and is resumable if it gets interrupted. It's handy. If you didn't want it to retain files Hudson has deleted, you could use /MIR instead of /E.

I'm sure similar tools for robust copies or mirroring exist on other platforms. Ant is probably sufficient if done right.



回答3:

There is awesome thinBackup plugin.

It backups only system configuration and job configurations instead of whole HUDSON_HOME directory and has cron-like scheduling. Sexy!



回答4:

I would manage it with a standard enterprise server backup solution.

Or roll my own with something like BackupPc.

Or check the config files into your version control system.



回答5:

I am using thinbackup, which supports full backup and differential backup, and you could schedule when it runs the backup using cron job like syntax. It only backups the critical configurations so it doesn't take much spaces.

See more details at: https://wiki.jenkins-ci.org/display/JENKINS/thinBackup



回答6:

Besides the Backup plugin there is also the thinBackup plugin to backup only the configuration files (available for Hudson or Jenkins)

I personally like to do all system backups via one system that is usually a shell script in the end. I wrote a Jenkins specific script for that (works for Hudson too). See https://bitbucket.org/toomasr/jenkins-stuff/src for more information.