The problem
backup policies on my network imply giving a path to backup and an optional command to run just before, so that I can prepare the backup
I need to backup my Jenkins configuration. Simply giving a path to the Jenkins data directory is not an option as:
- I just need to backup the configuration
- the total disk usage for that directory, ~ 80GB, is far beyond reasonable backup size (99% consist of non-critical workspace data)
So far
I installed the Backup Plugin and found reasonably good settings for it. Now I wonder if I can trigger it remotely using a bash script. I understand that using curl on the /jenkins/backup/launchBackup url should do the trick, but I’m getting a 403 Forbidden error as I’m hitting the URI as an anonymous user, and couldn’t find a solution to login or get around this.
So does anyone knows of a simple way to trigger a configuration only backup from the command line ?
The Jenkins wiki describes how to perform an authenticated login in scripts. Short answer: Go to the Configure screen from your user page and get the API token, then use it as your password when running your script.
I haven’t tried it with the Backup plugin, but it works for running regular builds so it should work for any scriptable invocation.
Without authentication:
With authentication:
Update: fixed the jobs typo, thanks for the comments.