From f60ed4d2089f413e3782961e9fcc736be83a2590 Mon Sep 17 00:00:00 2001 From: Anthony Brown <121869075+anthony-nhs@users.noreply.github.com> Date: Mon, 29 Apr 2024 10:33:23 +0000 Subject: [PATCH 1/2] delete aws sandbox stacks --- .github/scripts/delete_stacks.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/delete_stacks.sh b/.github/scripts/delete_stacks.sh index a3630315f..9f5262e85 100755 --- a/.github/scripts/delete_stacks.sh +++ b/.github/scripts/delete_stacks.sh @@ -2,7 +2,7 @@ echo "checking cloudformation stacks" echo -ACTIVE_STACKS=$(aws cloudformation list-stacks | jq -r '.StackSummaries[] | select ( .StackStatus != "DELETE_COMPLETE" ) | select( .StackName | capture("^psu-(sandbox-)?pr-(\\d+)$") ) | .StackName ') +ACTIVE_STACKS=$(aws cloudformation list-stacks | jq -r '.StackSummaries[] | select ( .StackStatus != "DELETE_COMPLETE" ) | select( .StackName | capture("^psu-pr-(\\d+)(-sandbox)?$") ) | .StackName ') mapfile -t ACTIVE_STACKS_ARRAY <<< "$ACTIVE_STACKS" From 35050178ee22c533925f7e53dc24ab9580541a5e Mon Sep 17 00:00:00 2001 From: Anthony Brown <121869075+anthony-nhs@users.noreply.github.com> Date: Mon, 29 Apr 2024 10:36:05 +0000 Subject: [PATCH 2/2] fix delete --- .github/scripts/delete_stacks.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/delete_stacks.sh b/.github/scripts/delete_stacks.sh index 9f5262e85..c42344123 100755 --- a/.github/scripts/delete_stacks.sh +++ b/.github/scripts/delete_stacks.sh @@ -10,7 +10,7 @@ for i in "${ACTIVE_STACKS_ARRAY[@]}" do echo "Checking if stack $i has open pull request" PULL_REQUEST=${i//psu-pr-/} - PULL_REQUEST=${PULL_REQUEST//psu-sandbox-pr-/} + PULL_REQUEST=${PULL_REQUEST//-sandbox/} echo "Checking pull request id ${PULL_REQUEST}" URL="https://api.github.com/repos/NHSDigital/eps-prescription-status-update-api/pulls/${PULL_REQUEST}" RESPONSE=$(curl "${URL}" 2>/dev/null)