Skip to content

Adding ci_secure_files to backup rake task

Darby Frey requested to merge secure-files-backup into master

What does this MR do and why?

This MR adds Project-level Secure Files to be included in GitLab backups.

Closes: gitlab-org/incubation-engineering/mobile-devops/readme#123 (closed)

Screenshots or screen recordings

How to set up and validate locally

  1. Upload a file to Secure Files by going into Settings > CI/CD for any project and uploading a file in the Secure Files section at the bottom of the page.
  2. Run the following rake task to run a backup of only the DB and Secure Files: bundle exec rake gitlab:backup:create SKIP=repositories,uploads,builds,artifacts,pages,lfs,terraform_state,registry,packages
  3. Note the backup name in the output, something like Backup 1684444017_2023_05_18_16.0.0-pre is done.
  4. Once the backup completes look in tmp/backups in the gitlab project and confirm that a new backup tar file has been created
  5. Untar that file and confirm a ci_secure_files tar file has been created
  6. Untar that file and confirm the file you uploaded was included in the backup. Note: you won't be able to view that file as it's been encrypted
  7. Back in the gitlab project, delete the file you uploaded, so we can restore it from the backup
  8. Now run bundle exec rake gitlab:backup:restore BACKUP=1684444017_2023_05_18_16.0.0-pre, replacing 1684444017_2023_05_18_16.0.0-pre with your backup name (this takes a while)
  9. Once the restore is done, got back to your project and confirm that the file has been restored

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 Darby Frey

Merge request reports