Skip to content

Cleanup task using AWS cli and max backup flags doesn't work

Summary

Running the cleanup process for the backup-utility does not work properly with the AWS CLI. When maximum-backups flag is set the grep regex is not processed properly because it does not recognize \d in regular expressions.

Steps to reproduce

run backup-utility --cleanup --s3tool awscli --maximum-backups (n)

No backups will show because the regex fails

Current behavior

Backup utility does not cleanup properly when using AWS CLI and max backup count due to the REGEX failing on grep -E. Bash doesn't recognize \d as a valid numeric literal and needs to be updated to [0-9]

Expected behavior

Expected number of documents to be returned by cleanup to be equal to the amount of objects in the S3 bucket.

Relevant logs

I have tested this with replacing \d with [0-9] and it behaves as expected on this line https://gitlab.com/gitlab-org/build/CNG/-/blob/master/gitlab-toolbox/scripts/bin/backup-utility#L124