From dfed67b89dad61a8aac162cc892debc55b47353b Mon Sep 17 00:00:00 2001 From: Chris Kalafarski Date: Fri, 19 Apr 2024 17:31:41 -0400 Subject: [PATCH] Pass health check IDs to deploy --- .github/workflows/deploy.yml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index b830f21..18107f2 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -73,7 +73,9 @@ jobs: check_id=$(aws cloudformation describe-stacks --region ${{ matrix.check-region }} --stack-name "$stack_name" --query "Stacks[0].Outputs[?OutputKey=='HealthCheckId'].OutputValue" --output text) echo "$check_id" > health_check_id - - uses: actions/upload-artifact@v4 + + - name: Capture health check ID + uses: actions/upload-artifact@v4 with: name: ${{ matrix.check-region }}-targeting-${{ matrix.target-region }} path: components/ftp-connection-check/health_check_id @@ -92,7 +94,8 @@ jobs: role-to-assume: arn:aws:iam::561178107736:role/PRX-GHA-AccessRole role-session-name: gha-deploy-prxtransfer-dns-connection-checker - - uses: actions/download-artifact@v4 + - name: Fetch health check IDs + uses: actions/download-artifact@v4 with: path: components/hosted-zone @@ -109,6 +112,14 @@ jobs: prod_use1_nlb_hostname=$(aws cloudformation describe-stacks --stack-name infrastructure-cd-root-production --query "Stacks[0].Outputs[?OutputKey=='ExchangeFtpServerNlbDnsName'].OutputValue" --output text --region us-east-1) prod_usw2_nlb_hostname=$(aws cloudformation describe-stacks --stack-name infrastructure-cd-root-production --query "Stacks[0].Outputs[?OutputKey=='ExchangeFtpServerNlbDnsName'].OutputValue" --output text --region us-west-2) + # Create a comma-delimited list of us-east-1 health check IDs + find . -path "*-targeting-us-east-1/health_check_id" -type f -exec cat {} \; > us_east_1 + us_east_1_check_ids=$(cat us_east_1 | awk '{printf("%s,",$0)}' | sed 's/,\s*$//') + + # Create a comma-delimited list of us-west-2 health check IDs + find . -path "*-targeting-us-west-2/health_check_id" -type f -exec cat {} \; > us_west_2 + us_west_2_check_ids=$(cat us_west_2 | awk '{printf("%s,",$0)}' | sed 's/,\s*$//') + # Deploy the stack using all the values collected aws cloudformation deploy \ --template-file template.yml \ @@ -121,4 +132,5 @@ jobs: StagNlbHostnameUSWEST2=$stag_usw2_nlb_hostname \ ProdNlbHostnameUSEAST1=$prod_use1_nlb_hostname \ ProdNlbHostnameUSWEST2=$prod_usw2_nlb_hostname \ - ProdHealthCheckIdsTargetingUSEAST1= + ProdHealthCheckIdsTargetingUSEAST1=$us_east_1_check_ids + ProdHealthCheckIdsTargetingUSWEST2=$us_west_2_check_ids