From b63966a9d960d4185b7f54843423e81fc3e2beea Mon Sep 17 00:00:00 2001 From: anayeaye Date: Wed, 11 Oct 2023 11:58:26 -0600 Subject: [PATCH 1/4] ci: branch specific pre-deploy check on pull request action --- .github/workflows/pr.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index fb995998..6062733b 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -116,10 +116,15 @@ jobs: python -m pip install --upgrade pip python -m pip install -e .[dev,deploy,test] - - name: Get dev environment configuration for develop branch - run: ./scripts/get-env.sh "veda-backend-uah-dev-env" - + - name: Get environment configuration for target branch + run: | + if [ "${{ github.ref_name }}" == "main" ]; then + ./scripts/get-env.sh "veda-backend-uah-staging-env" + elif [ "${{ github.ref_name }}" == "develop" ]; then + ./scripts/get-env.sh "veda-backend-uah-dev-env" + else + echo "No environment associated with ${GITHUB_REF##*/} branch" - name: Pre deployment CDK diff run: | echo $STAGE - cdk diff veda-backend-uah-dev + cdk diff From f41c7fb2e929f4bc7d53a24172609b4bde1c879c Mon Sep 17 00:00:00 2001 From: anayeaye Date: Wed, 11 Oct 2023 12:04:56 -0600 Subject: [PATCH 2/4] ci: pre-deploy test against dev stack by default --- .github/workflows/pr.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 6062733b..469d3a72 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -123,7 +123,8 @@ jobs: elif [ "${{ github.ref_name }}" == "develop" ]; then ./scripts/get-env.sh "veda-backend-uah-dev-env" else - echo "No environment associated with ${GITHUB_REF##*/} branch" + echo "No environment associated with ${GITHUB_REF##*/} branch. Test changes against dev stack" + ./scripts/get-env.sh "veda-backend-uah-dev-env" - name: Pre deployment CDK diff run: | echo $STAGE From a7d7ba7677fbc894af4bf0c671fa794eecb4e29b Mon Sep 17 00:00:00 2001 From: anayeaye Date: Wed, 11 Oct 2023 15:24:27 -0600 Subject: [PATCH 3/4] fix github var name in action --- .github/workflows/pr.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 469d3a72..887c2b33 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -118,9 +118,9 @@ jobs: - name: Get environment configuration for target branch run: | - if [ "${{ github.ref_name }}" == "main" ]; then + if [ "${{ github.base_ref }}" == "main" ]; then ./scripts/get-env.sh "veda-backend-uah-staging-env" - elif [ "${{ github.ref_name }}" == "develop" ]; then + elif [ "${{ github.base_ref }}" == "develop" ]; then ./scripts/get-env.sh "veda-backend-uah-dev-env" else echo "No environment associated with ${GITHUB_REF##*/} branch. Test changes against dev stack" From 60e894be7a74d72ea35c43bfc8ad13f66b36d058 Mon Sep 17 00:00:00 2001 From: anayeaye Date: Wed, 11 Oct 2023 15:40:29 -0600 Subject: [PATCH 4/4] typo --- .github/workflows/pr.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 887c2b33..9a89ba42 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -125,6 +125,7 @@ jobs: else echo "No environment associated with ${GITHUB_REF##*/} branch. Test changes against dev stack" ./scripts/get-env.sh "veda-backend-uah-dev-env" + fi - name: Pre deployment CDK diff run: | echo $STAGE