Extract backup tasks
What does this MR do and why?
To create an incremental repository backup, we need a bit more shared information (specifically the backup ID), but sharing state between rake tasks is difficult. Since we aren't really using any rake specific features here, I think it is easier to extract all the tasks into a PORO. In order to maintain backwards compatibility, all the rake tasks continue to work as they did before.
The goal here is to extract the rake tasks without modification. These tasks still have test coverage via backup_rake_spec.rb
. There are still a lot of tidyups that could happen here, but this MR is large enough as it is.
How to set up and validate locally
-
Create a backup.
$ bundle exec rake gitlab:backup:create ... Creating backup archive: 1644531746_2022_02_11_14.8.0-pre_gitlab_backup.tar ... done Uploading backup archive to remote storage ... skipped Deleting tmp directories ... done done done done done done done done done done Deleting old backups ... skipping Warning: Your gitlab.rb and gitlab-secrets.json files contain sensitive data and are not included in this backup. You will need these files to restore a backup. Please back them up manually. Backup task is done.
-
Restore from the backup.
$ bundle exec rake gitlab:backup:restore BACKUP=1644531746_2022_02_11_14.8.0-pre ...
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.