Skip to content

Extract backup tasks

James Fargher requested to merge backup_tasks into master

What does this MR do and why?

#351383 (closed)

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

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

Edited by James Fargher

Merge request reports

Loading