File tree Expand file tree Collapse file tree 2 files changed +34
-16
lines changed Expand file tree Collapse file tree 2 files changed +34
-16
lines changed Original file line number Diff line number Diff line change @@ -74,14 +74,23 @@ jobs:
7474 | jq -r '.[] | select(.Priority | tonumber > ${{ env.MAXIMUM_NUMBER_OF_RAINBOW_DEPLOYMENTS_TO_KEEP_ALIVE }}) | .RuleArn'
7575 ))
7676
77- if [ ${#arn_list[*]} -gt 0 ]; then
78- deployment_ids=$(
79- aws elbv2 describe-tags \
80- --resource-arns "${arn_list[@]}" \
81- | jq -r '[.TagDescriptions[].Tags[] | select(.Key == "Name") | .Value | sub("^rainbow-"; "")]'
82- )
83-
84- echo "ids=$(echo $deployment_ids | sed 's/ //g')" >> "$GITHUB_OUTPUT"
77+ if [ ${#arn_list[@]} -gt 0 ]; then
78+ deployment_ids=()
79+
80+ # Process ARNs in batches of 20
81+ for ((i=0; i<${#arn_list[@]}; i+=20)); do
82+ batch=("${arn_list[@]:i:20}")
83+
84+ batch_ids=$(aws elbv2 describe-tags \
85+ --resource-arns "${batch[@]}" \
86+ | jq -r '[.TagDescriptions[].Tags[] | select(.Key == "Name") | .Value | sub("^rainbow-"; "")][]')
87+
88+ deployment_ids+=($batch_ids)
89+ done
90+
91+ json_array=$(printf '%s\n' "${deployment_ids[@]}" | jq -R . | jq -s .)
92+
93+ echo "ids=$(echo $json_array | sed 's/ //g')" >> "$GITHUB_OUTPUT"
8594 fi
8695
8796 cleanup-schedule-2 :
Original file line number Diff line number Diff line change 1212 type : string
1313 required : true
1414 schedule :
15- - cron : " 0 4 * * *" # Nightly at 4am
15+ - cron : " 0 5,17 * * *" # Every day at noon and midnight (EST)
1616
1717env :
1818 AWS_ACCOUNT_ID : ${{ vars.STAGING_AWS_ACCOUNT_ID }}
@@ -74,14 +74,23 @@ jobs:
7474 | jq -r '.[] | select(.Priority | tonumber > ${{ env.MAXIMUM_NUMBER_OF_RAINBOW_DEPLOYMENTS_TO_KEEP_ALIVE }}) | .RuleArn'
7575 ))
7676
77- if [ ${#arn_list[*]} -gt 0 ]; then
78- deployment_ids=$(
79- aws elbv2 describe-tags \
80- --resource-arns "${arn_list[@]}" \
81- | jq -r '[.TagDescriptions[].Tags[] | select(.Key == "Name") | .Value | sub("^rainbow-"; "")]'
82- )
77+ if [ ${#arn_list[@]} -gt 0 ]; then
78+ deployment_ids=()
8379
84- echo "ids=$(echo $deployment_ids | sed 's/ //g')" >> "$GITHUB_OUTPUT"
80+ # Process ARNs in batches of 20
81+ for ((i=0; i<${#arn_list[@]}; i+=20)); do
82+ batch=("${arn_list[@]:i:20}")
83+
84+ batch_ids=$(aws elbv2 describe-tags \
85+ --resource-arns "${batch[@]}" \
86+ | jq -r '[.TagDescriptions[].Tags[] | select(.Key == "Name") | .Value | sub("^rainbow-"; "")][]')
87+
88+ deployment_ids+=($batch_ids)
89+ done
90+
91+ json_array=$(printf '%s\n' "${deployment_ids[@]}" | jq -R . | jq -s .)
92+
93+ echo "ids=$(echo $json_array | sed 's/ //g')" >> "$GITHUB_OUTPUT"
8594 fi
8695
8796 cleanup-schedule-2 :
You can’t perform that action at this time.
0 commit comments