Skip to content

Commit

Permalink
Merge pull request #29 from vectornguyen76/develop
Browse files Browse the repository at this point in the history
Update destroy stack
  • Loading branch information
vectornguyen76 committed Dec 29, 2023
2 parents 7b62634 + 84c08ca commit 25a8578
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/production_pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -321,14 +321,21 @@ jobs:
)
)
for stack in "${STACKS[@]}"; do
if [[ ! "$stack" =~ "${{ env.SHA_SHORT }}" ]] && [[ "$stack" =~ "search-engine" ]]; then
if [[ ! "$stack" =~ "${{ env.SHA_SHORT }}" ]] && [[ "$stack" =~ "search-engine-prod" ]]; then
echo "DESTROY_STACK=$stack" >> "$GITHUB_ENV"
fi
done
- name: Remove the search engine infrastructure
run: |
echo ${{ env.DESTROY_STACK }}
# Check if DESTROY_STACK is not set
if [ -z "${{ env.DESTROY_STACK }}" ]; then
echo "DESTROY_STACK is not set"
exit 0
else
echo "DESTROY_STACK is set to ${{ env.DESTROY_STACK }}"
fi
# Get stack id for the delete_stack waiter
stack_info=$(aws cloudformation describe-stacks --stack-name ${{ env.DESTROY_STACK }} --query "Stacks[*] | [0].StackId" 2>&1)
if echo $stack_info | grep 'does not exist' > /dev/null
Expand Down
11 changes: 9 additions & 2 deletions .github/workflows/staging_pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -321,14 +321,21 @@ jobs:
)
)
for stack in "${STACKS[@]}"; do
if [[ ! "$stack" =~ "${{ env.SHA_SHORT }}" ]] && [[ "$stack" =~ "search-engine" ]]; then
if [[ ! "$stack" =~ "${{ env.SHA_SHORT }}" ]] && [[ "$stack" =~ "search-engine-staging" ]]; then
echo "DESTROY_STACK=$stack" >> "$GITHUB_ENV"
fi
done
- name: Remove the search engine infrastructure
run: |
echo ${{ env.DESTROY_STACK }}
# Check if DESTROY_STACK is not set
if [ -z "${{ env.DESTROY_STACK }}" ]; then
echo "DESTROY_STACK is not set"
exit 0
else
echo "DESTROY_STACK is set to ${{ env.DESTROY_STACK }}"
fi
# Get stack id for the delete_stack waiter
stack_info=$(aws cloudformation describe-stacks --stack-name ${{ env.DESTROY_STACK }} --query "Stacks[*] | [0].StackId" 2>&1)
if echo $stack_info | grep 'does not exist' > /dev/null
Expand Down

0 comments on commit 25a8578

Please sign in to comment.