Skip to content

Backups: Fix parsing of existing backups in Azure storage

What does this MR do?

Backups: Fix parsing of existing backups in Azure storage

The output format of azcopy list has changed in v10.25.0, breaking the functionality to parse the current amount of backups in Azure storage.

Fixed by passing --output-format=json (introduced in v10.25.0) and parsing the result with jq.

Closes gitlab-org/charts/gitlab#5652 (closed)

Changelog: fixed

Signed-off-by: Clemens Beck cbeck@gitlab.com

Related issues

Checklist

See Definition of done.

For anything in this list which will not be completed, please provide a reason in the MR discussion

Required

  • Merge Request Title, and Description are up to date, accurate, and descriptive
  • MR targeting the appropriate branch
  • MR has a green pipeline on GitLab.com
  • When ready for review, MR is labeled "~workflow::ready for review" per the Distribution MR workflow

Expected (please provide an explanation if not completing)

  • Test plan indicating conditions for success has been posted and passes
  • Documentation created/updated
  • Integration tests added to GitLab QA
  • The impact any change in container size has should be evaluated
  • New dependencies are managed with dependencies.io

Test Plan

Note: This test plan requires access to an Azure (sandbox) account.

  1. Install upgrade GitLab to use Azure OS

    Example values:

    global:
      minio:
        enabled: false
      appConfig:
        object_store:
          enabled: true
          connection:
            key: connection
            secret: gitlab-rails-storage
    
    gitlab:
      toolbox:
        backups:
          objectStorage:
            backend: azure
            config:
              key: connection
              secret: gitlab-rails-storage
          cron:
            enabled: false

    Create the gitlab-rails-storage by following https://docs.gitlab.com/charts/advanced/external-object-storage/#azure-blob-storage

  2. Create the expected buckets (default: tmp, gitlab-backups, uploads)

  3. Log into the instance and attach an image to an issue

  4. Run backup-utility a few times

  5. Run backup-utility and set --maximum-backups

  6. Confirm the oldest backups are deleted:

    [DONE] Backup can be found at /gitlab-backups/1721641933_2024_07_22_17.3.0-pre_gitlab_backup.tar
    Found 4 existing backups. Maximum allowed is 2
    Deleting old backup 1721641656_2024_07_22_17.3.0-pre_gitlab_backup.tar
    ...
    Deleting old backup 1721641739_2024_07_22_17.3.0-pre_gitlab_backup.tar
    ...
    [DONE] Finished pruning old backups
Edited by Clemens Beck

Merge request reports

Loading