Skip to content

Commit 4af67c8

Browse files
ci: limit S3 recovery to 7 days in the past (#2006)
1 parent 97527f8 commit 4af67c8

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

.github/workflows/recover_s3_repository.yml

+9-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ on:
2323
path:
2424
description: 'Path under infrastructure_agent folder to recover (w/o leading nor trailing slash)'
2525
type: string
26-
required: true
26+
required: false
2727
environment:
2828
type: choice
2929
required: true
@@ -66,6 +66,14 @@ jobs:
6666
fi
6767
echo "datetime is not in the future"
6868
69+
echo "Validating that datetime is max 7 days in the past"
70+
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)"
71+
exit_code=$?
72+
if [ $exit_code -ne 0 ]; then
73+
exit 1
74+
fi
75+
echo "datetime cannot be more than 7 days in the past"
76+
6977
echo "DATE_TIME=$datetime" >> $GITHUB_ENV
7078
7179
- name: Validate path input does not have leading nor trailing slash

0 commit comments

Comments
 (0)