qvest-task/scripts/empty-s3-bucket.sh
gitea_admin 685de1816d feat: implement update automation and backup system with CI tests (#1)
- Diun monitors Docker images
- Automated updates for nginx, manual approval for gitea/postgres
- Weekly cert renewal automation via cron
- Health checks with automatic rollback on failure
- AWS SES email notifications on update failures
- Daily S3 backups + pre-update snapshots
- Integration tests with Gitea Actions quality gate
- Change domain from gitea.poll-streams.com to git.poll-streams.com
- Add diagrams
2026-06-11 15:51:48 +00:00

27 lines
831 B
Bash
Executable File

#!/bin/bash
set -e
BUCKET_NAME="${1:-qvest-task-backups}"
echo "Emptying S3 bucket: $BUCKET_NAME"
# Delete all object versions
aws s3api list-object-versions --bucket "$BUCKET_NAME" --output text \
--query 'Versions[].[Key,VersionId]' 2>/dev/null | \
while read -r key version; do
if [ -n "$key" ]; then
aws s3api delete-object --bucket "$BUCKET_NAME" --key "$key" --version-id "$version" >/dev/null 2>&1
fi
done || true
# Delete all delete markers
aws s3api list-object-versions --bucket "$BUCKET_NAME" --output text \
--query 'DeleteMarkers[].[Key,VersionId]' 2>/dev/null | \
while read -r key version; do
if [ -n "$key" ]; then
aws s3api delete-object --bucket "$BUCKET_NAME" --key "$key" --version-id "$version" >/dev/null 2>&1
fi
done || true
echo "S3 bucket emptied successfully"