Unified Backup: Refactor creation and restore backups of files
What does this MR do and why?
- Creates
Gitlab::Backup::Cli::Shell::Pipeline
to handle command pipeline execution (e.g.command | another | yet another
) - Extracted
Utils::Tar#pack_cmd
and refactor target/files to use it - Extracted
Utils::Tar#unpack_cmd
and refactor target/files to use it - Improve target/files specs to test things against the filesystem instead of mocking everything
Related to #427337 (closed)
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
How to set up and validate locally
We should check creating a backup and restoring from it.
We should also check creating a backup with STRATEGY=copy
Similar to the other refactors, this should not break any existing backup functionality, as its not adding or modifying any existing behavior:
Testing backup creation
Run rake gitlab:backup:create
2024-02-20 14:49:46 UTC -- Dumping database ...
Dumping PostgreSQL database gitlabhq_development ... [DONE]
Dumping PostgreSQL database gitlabhq_development_ci ... [DONE]
2024-02-20 14:49:50 UTC -- Dumping database ... done
...
2024-02-20 14:49:54 UTC -- Backup 1708440586_2024_02_20_16.10.0-pre is done.
2024-02-20 14:49:54 UTC -- Deleting backup and restore PID file ... done
-
Go to
tmp/backups
-
Unpack the generated tar file:
tar zxvf 1708440586_2024_02_20_16.10.0-pre_gitlab_backup.tar
-
It should include all backed up content
Testing backup restore
Run rake gitlab:backup:restore BACKUP=1708440586_2024_02_20_16.10.0-pre
(change BACKUP=
to point to the correct name from previous step)
Navigate to test everything it ok.
Related to #427337 (closed)