Skip to content

Refactor database target for backups

Aakriti Gupta requested to merge ag-refactor-database-target into master

What does this MR do and why?

This MR refactors the database target for backups to simplify the logic. It also converts the execution to use Shell::Pipeline, and improve it to use ENV variables when provided.

Refactor database target for backups

  • don't check for db adapter because we have only one
  • run decompression and PG restore commands in one pipeline

This MR depends on some refactoring done in !163584 (merged), so it cannot be merged until !163584 (merged) and !164205 (merged) are merged.

The MR does not include tests for the Targets::Database class as we can only do that when it is fully is decoupled from the rails codebase via #481435.

Related issue: #494209

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

  1. Run a regular backup: ./bin/gitlab-backup-cli backup all
  2. Note down the backup identification, something like this: 1730476493_2024_11_01_17.6.0-pre
  3. Reuse it in the next command to restore from the backup: ./bin/gitlab-backup-cli restore all BACKUP_ID_FROM_BEFORE

It should successfully backup and restore.

Edited by Gabriel Mazetto

Merge request reports

Loading