@@ -28,6 +28,7 @@ CLOUD_REAPER_IMAGE="${DOCKER_REGISTRY}/observability-ci/cloud-reaper:0.3.0"
2828DRY_RUN=" $( buildkite-agent meta-data get DRY_RUN --default " ${DRY_RUN:- " true" } " ) "
2929
3030resources_to_delete=0
31+ resources_failed_to_delete=0
3132
3233COMMAND=" validate"
3334redshift_message=" "
@@ -70,7 +71,7 @@ any_resources_failed_to_delete() {
7071 # In the case, there is nothing to delete, there is one more line:
7172 # ⇒ Nothing to destroy !
7273 if [[ " ${DRY_RUN} " == false ]] ; then
73- if tail -n 1 ${file} | grep -q " Nothing to destroy" ; then
74+ if tail -n 1 " ${file} " | grep -q " Nothing to destroy" ; then
7475 return 1
7576 fi
7677 # cloud-reaper should show FAILED in case there is some error deleting resources
@@ -175,13 +176,13 @@ if [ "${resources_to_delete}" -eq 1 ]; then
175176 if running_on_buildkite ; then
176177 buildkite-agent annotate \
177178 " ${message} " \
178- --context " ctx-cloud-reaper-error" \
179+ --context " ctx-cloud-reaper-error-pending " \
179180 --style " error"
180181 fi
181182fi
182183
183184if [ " ${resources_failed_to_delete} " -eq 1 ]; then
184- message=" There are resources to could not be deleted"
185+ message=" There are resources that could not be deleted. Check the logs for details. "
185186 echo " ${message} "
186187 if running_on_buildkite ; then
187188 buildkite-agent annotate \
@@ -274,7 +275,7 @@ if [ "${redshift_clusters_to_delete}" -eq 1 ]; then
274275 if running_on_buildkite ; then
275276 buildkite-agent annotate \
276277 " ${message} " \
277- --context " ctx-aws-readshift -error" \
278+ --context " ctx-aws-redshift -error-pending " \
278279 --style " error"
279280 fi
280281fi
0 commit comments