Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: limit S3 recovery to 7 days in the past #2006

Merged
merged 1 commit into from
Jan 23, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .github/workflows/recover_s3_repository.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ on:
path:
description: 'Path under infrastructure_agent folder to recover (w/o leading nor trailing slash)'
type: string
required: true
required: false
environment:
type: choice
required: true
Expand Down Expand Up @@ -66,6 +66,14 @@ jobs:
fi
echo "datetime is not in the future"

echo "Validating that datetime is max 7 days in the past"
python3 -c "from datetime import datetime, timezone, timedelta; import sys; sys.exit(0) if datetime.strptime('$datetime', '%m-%d-%Y %H:%M:%S %z') >= datetime.now(timezone.utc) - timedelta(days=7) else sys.exit(1)"
exit_code=$?
if [ $exit_code -ne 0 ]; then
exit 1
fi
echo "datetime cannot be more than 7 days in the past"

echo "DATE_TIME=$datetime" >> $GITHUB_ENV

- name: Validate path input does not have leading nor trailing slash
Expand Down
Loading