File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,15 @@ aws s3api list-buckets \
48
48
| grep -E ' buildkite-aws-stack-test-.*-managedsecretsbucket' \
49
49
| xargs -n1 -t -I% aws s3 rb s3://% --force
50
50
51
+ # Do this before deleting the stacks so we don't race with stack-managed log
52
+ # groups
53
+ echo " --- Deleting old lambda logs after ${cutoff_date_milli} "
54
+ aws logs describe-log-groups \
55
+ --log-group-name-prefix " /aws/lambda/buildkite-aws-stack-test-" \
56
+ --query " $( printf ' logGroups[?creationTime<`%s`].[logGroupName]' " $cutoff_date_milli " ) " \
57
+ --output text \
58
+ | xargs -n1 -t -I% aws logs delete-log-group --log-group-name " %"
59
+
51
60
echo " --- Deleting old cloudformation stacks"
52
61
aws cloudformation describe-stacks \
53
62
--output text \
@@ -62,10 +71,3 @@ aws ec2 describe-instances \
62
71
--query " $( printf ' Reservations[].Instances[?LaunchTime<`%s`].[InstanceId]' " $cutoff_date " ) " \
63
72
--output text \
64
73
| xargs -n1 -t -I% aws ec2 terminate-instances --instance-ids " %"
65
-
66
- echo " --- Deleting old lambda logs after ${cutoff_date_milli} "
67
- aws logs describe-log-groups \
68
- --log-group-name-prefix " /aws/lambda/buildkite-aws-stack-test-" \
69
- --query " $( printf ' logGroups[?creationTime<`%s`].[logGroupName]' " $cutoff_date_milli " ) " \
70
- --output text \
71
- | xargs -n1 -t -I% aws logs delete-log-group --log-group-name " %"
You can’t perform that action at this time.
0 commit comments