File tree 1 file changed +9
-7
lines changed
1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change 21
21
type : string
22
22
required : true
23
23
time :
24
- description : ' UTC Time (HH:MM:SS)'
24
+ description : ' UTC Time (HH:MM:SS) (minutes and seconds optional) '
25
25
type : string
26
26
required : true
27
27
environment :
32
32
- staging
33
33
- production
34
34
default : ' staging'
35
+ filter :
36
+ description : ' filter by regex in staging'
37
+ type : string
38
+ default : ' .*'
39
+ required : false
35
40
36
41
jobs :
37
42
list-files :
43
48
set -e
44
49
datetime="${{ github.event.inputs.date_year }}-${{ github.event.inputs.date_month }}-${{ github.event.inputs.date_day }} ${{ github.event.inputs.time }}"
45
50
# Regular expression to match the format YYYY-MM-DD HH:MM:SS
46
- regex="^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{ 2}$"
51
+ regex="^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}( :[0-9]{2}){0, 2}$"
47
52
48
- if [[ $datetime =~ $regex ]]; then
49
- # Use date command to check if it's a valid date
50
- date -d "$datetime" >/dev/null 2>&1 || exit 1
51
- else
53
+ if [[ ! $datetime =~ $regex ]]; then
52
54
exit 1
53
55
fi
54
56
echo "DATE_TIME=$datetime" >> $GITHUB_ENV
66
68
- name : List files created before and after datetime in Staging S3
67
69
if : ${{ github.event.inputs.environment == 'staging' }}
68
70
run : |
69
- TZ="UTC" aws s3 ls s3://nr-downloads-ohai-staging/infrastructure_agent/ --recursive | sort | grep --color -m 1 -C ${{ github.event.inputs.count }} "^${{ env.DATE_TIME }}"
71
+ TZ="UTC" aws s3 ls s3://nr-downloads-ohai-staging/infrastructure_agent/ --recursive | sort | grep -E "${{ github.event.inputs.filter }}" | grep - -color -m 1 -C ${{ github.event.inputs.count }} "^${{ env.DATE_TIME }}"
70
72
env :
71
73
AWS_ACCESS_KEY_ID : ${{ secrets.OHAI_AWS_ACCESS_KEY_ID_STAGING }}
72
74
AWS_SECRET_ACCESS_KEY : ${{ secrets.OHAI_AWS_SECRET_ACCESS_KEY_STAGING }}
You can’t perform that action at this time.
0 commit comments