From 42887691e29d842ca0b50679a3d5c3d509242742 Mon Sep 17 00:00:00 2001 From: brendagutman Date: Fri, 27 Dec 2024 15:59:46 -0600 Subject: [PATCH 1/5] [FD-1831] Update deployments to use env SERVICE --- .github/workflows/deploy_dev.yml | 11 +++++------ .github/workflows/deploy_prod.yml | 2 +- .github/workflows/deploy_qa.yml | 13 ++++++++----- .github/workflows/dispatch_deploy.yml | 15 ++++++--------- 4 files changed, 20 insertions(+), 21 deletions(-) diff --git a/.github/workflows/deploy_dev.yml b/.github/workflows/deploy_dev.yml index b05f400..5c1b8cb 100644 --- a/.github/workflows/deploy_dev.yml +++ b/.github/workflows/deploy_dev.yml @@ -11,7 +11,7 @@ env: PROJECT_ID: ${{ secrets.PROJECT_ID }} REGION: ${{ secrets.REGION_LOC_1 }} - SERVICE: 'mapdragon' + SERVICE: ${{ secrets.SERVICE }} IMAGE_NAME: 'map-dragon_img' GCP_CREDENTIALS: ${{ secrets.GCP_CREDENTIALS }} @@ -62,18 +62,17 @@ jobs: - name: 'Build Docker Image' # New step to build the image run: |- - DOCKER_TAG="${{ env.REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE }}-dev/${{ env.IMAGE_NAME }}:${{ github.sha }}" + DOCKER_TAG="${{ env.REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE }}/${{ env.IMAGE_NAME }}:${{ github.sha }}" docker build -t "${DOCKER_TAG}" --build-arg ENV=dev . - name: 'Push Docker Image' run: |- - DOCKER_TAG="${{ env.REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE }}-dev/${{ env.IMAGE_NAME }}:${{ github.sha }}" + DOCKER_TAG="${{ env.REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE }}/${{ env.IMAGE_NAME }}:${{ github.sha }}" docker push "${DOCKER_TAG}" - name: 'Deploy to Cloud Run' uses: 'google-github-actions/deploy-cloudrun@v2' with: - service: '${{ env.SERVICE }}-dev' + service: '${{ env.SERVICE }}' region: '${{ env.REGION }}' - image: "${{ env.REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE }}-dev/${{ env.IMAGE_NAME }}:${{ github.sha }}" - env_vars: VERSION=${VERSION} \ No newline at end of file + image: "${{ env.REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE }}/${{ env.IMAGE_NAME }}:${{ github.sha }}" diff --git a/.github/workflows/deploy_prod.yml b/.github/workflows/deploy_prod.yml index 019584d..4aa01e2 100644 --- a/.github/workflows/deploy_prod.yml +++ b/.github/workflows/deploy_prod.yml @@ -13,7 +13,7 @@ env: PROJECT_ID: ${{ secrets.PROJECT_ID }} REGION: ${{ secrets.REGION_LOC_1 }} - SERVICE: 'mapdragon' + SERVICE: ${{ secrets.SERVICE }} IMAGE_NAME: 'map-dragon_img' GCP_CREDENTIALS: ${{ secrets.GCP_CREDENTIALS }} diff --git a/.github/workflows/deploy_qa.yml b/.github/workflows/deploy_qa.yml index 748a9e6..335f6ac 100644 --- a/.github/workflows/deploy_qa.yml +++ b/.github/workflows/deploy_qa.yml @@ -14,7 +14,11 @@ env: PROJECT_ID: ${{ secrets.PROJECT_ID }} REGION: ${{ secrets.REGION_LOC_1 }} +<<<<<<< Updated upstream SERVICE: 'mapdragon' +======= + SERVICE: ${{ secrets.SERVICE }} +>>>>>>> Stashed changes IMAGE_NAME: 'map-dragon_img' GCP_CREDENTIALS: ${{ secrets.GCP_CREDENTIALS }} @@ -61,18 +65,17 @@ jobs: - name: 'Build Docker Image' # New step to build the image run: |- - DOCKER_TAG="${{ env.REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE }}-uat/${{ env.IMAGE_NAME }}:${{ github.sha }}" + DOCKER_TAG="${{ env.REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE }}/${{ env.IMAGE_NAME }}:${{ github.sha }}" docker build -t "${DOCKER_TAG}" --build-arg ENV=uat . - name: 'Push Docker Image' run: |- - DOCKER_TAG="${{ env.REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE }}-uat/${{ env.IMAGE_NAME }}:${{ github.sha }}" + DOCKER_TAG="${{ env.REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE }}/${{ env.IMAGE_NAME }}:${{ github.sha }}" docker push "${DOCKER_TAG}" - name: 'Deploy to Cloud Run' uses: 'google-github-actions/deploy-cloudrun@v2' with: - service: '${{ env.SERVICE }}-uat' + service: '${{ env.SERVICE }}' region: '${{ env.REGION }}' - image: "${{ env.REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE }}-uat/${{ env.IMAGE_NAME }}:${{ github.sha }}" - env_vars: VERSION=${VERSION} \ No newline at end of file + image: "${{ env.REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE }}/${{ env.IMAGE_NAME }}:${{ github.sha }}" diff --git a/.github/workflows/dispatch_deploy.yml b/.github/workflows/dispatch_deploy.yml index 5e7358d..1145a77 100644 --- a/.github/workflows/dispatch_deploy.yml +++ b/.github/workflows/dispatch_deploy.yml @@ -7,7 +7,7 @@ on: workflow_dispatch: inputs: environment: - description: 'Deployment environment (e.g., dev, uat, prod, alpha)' + description: 'Deployment environment (e.g., dev, uat, prod, alpha, kf)' required: true type: string default: 'dev' @@ -26,7 +26,7 @@ env: PROJECT_ID: ${{ secrets.PROJECT_ID }} REGION: ${{ secrets.REGION_LOC_1 }} - SERVICE: 'mapdragon' + SERVICE: ${{ secrets.SERVICE }} IMAGE_NAME: 'map-dragon_img' GCP_CREDENTIALS: ${{ secrets.GCP_CREDENTIALS }} @@ -48,6 +48,9 @@ jobs: uses: 'actions/checkout@v4' with: ref: ${{ github.event.inputs.deploy_branch }} # This branch is deployed + + - name: "Deploying ${{ github.event.inputs.deploy_branch }} to ${{ github.event.inputs.environment }}" + run: echo "Deploying ${{ github.event.inputs.deploy_branch }} to ${{ github.event.inputs.environment }}" - id: 'auth' name: 'Authenticate to Google Cloud' @@ -67,15 +70,9 @@ jobs: - name: 'Build Docker Image' run: |- - if [[ "${{ github.event.inputs.environment }}" == "prod" ]]; then - SERVICE="${{ env.SERVICE }}" - else - SERVICE="${{ env.SERVICE }}-${{ github.event.inputs.environment }}" - fi - DOCKER_TAG="${{ env.REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${SERVICE}/${{ env.IMAGE_NAME }}:${{ github.sha }}" + DOCKER_TAG="${{ env.REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE }}/${{ env.IMAGE_NAME }}:${{ github.sha }}" echo "DOCKER_TAG=${DOCKER_TAG}" >> $GITHUB_ENV - echo "SERVICE=${SERVICE}" >> $GITHUB_ENV docker build -t "${DOCKER_TAG}" --build-arg ENV=${{ github.event.inputs.environment }} . From e63d6d9b6accc9a7daeacb7a2d26cc56cce9cd7c Mon Sep 17 00:00:00 2001 From: brendagutman Date: Fri, 27 Dec 2024 16:06:19 -0600 Subject: [PATCH 2/5] [FD-1831] Edit qa trigger --- .github/workflows/deploy_qa.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deploy_qa.yml b/.github/workflows/deploy_qa.yml index 335f6ac..9183ab5 100644 --- a/.github/workflows/deploy_qa.yml +++ b/.github/workflows/deploy_qa.yml @@ -14,11 +14,7 @@ env: PROJECT_ID: ${{ secrets.PROJECT_ID }} REGION: ${{ secrets.REGION_LOC_1 }} -<<<<<<< Updated upstream - SERVICE: 'mapdragon' -======= SERVICE: ${{ secrets.SERVICE }} ->>>>>>> Stashed changes IMAGE_NAME: 'map-dragon_img' GCP_CREDENTIALS: ${{ secrets.GCP_CREDENTIALS }} @@ -28,6 +24,8 @@ jobs: deploy: runs-on: 'ubuntu-latest' + if: github.event.pull_request.base.ref == 'release' + environment: name: uat From b3353eb67be3f1019af0ec59b65d05993efa0836 Mon Sep 17 00:00:00 2001 From: brendagutman Date: Fri, 27 Dec 2024 16:10:08 -0600 Subject: [PATCH 3/5] [FD-1831] Ensure version --- .github/workflows/deploy_dev.yml | 1 + .github/workflows/deploy_qa.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/deploy_dev.yml b/.github/workflows/deploy_dev.yml index 5c1b8cb..fa31374 100644 --- a/.github/workflows/deploy_dev.yml +++ b/.github/workflows/deploy_dev.yml @@ -76,3 +76,4 @@ jobs: service: '${{ env.SERVICE }}' region: '${{ env.REGION }}' image: "${{ env.REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE }}/${{ env.IMAGE_NAME }}:${{ github.sha }}" + env_vars: VERSION=${VERSION} diff --git a/.github/workflows/deploy_qa.yml b/.github/workflows/deploy_qa.yml index 9183ab5..e611272 100644 --- a/.github/workflows/deploy_qa.yml +++ b/.github/workflows/deploy_qa.yml @@ -77,3 +77,4 @@ jobs: service: '${{ env.SERVICE }}' region: '${{ env.REGION }}' image: "${{ env.REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE }}/${{ env.IMAGE_NAME }}:${{ github.sha }}" + env_vars: VERSION=${VERSION} \ No newline at end of file From e1ef32d0ce9aa8280b30365b0ee8dd7e3b115732 Mon Sep 17 00:00:00 2001 From: brendagutman Date: Fri, 27 Dec 2024 16:11:54 -0600 Subject: [PATCH 4/5] [FD-1831] Clean PR --- .github/workflows/deploy_dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy_dev.yml b/.github/workflows/deploy_dev.yml index fa31374..726bbde 100644 --- a/.github/workflows/deploy_dev.yml +++ b/.github/workflows/deploy_dev.yml @@ -76,4 +76,4 @@ jobs: service: '${{ env.SERVICE }}' region: '${{ env.REGION }}' image: "${{ env.REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE }}/${{ env.IMAGE_NAME }}:${{ github.sha }}" - env_vars: VERSION=${VERSION} + env_vars: VERSION=${VERSION} \ No newline at end of file From c83ee6248d99e4710a58ab451d1ccd5da320a1c7 Mon Sep 17 00:00:00 2001 From: brendagutman Date: Mon, 30 Dec 2024 15:18:56 -0600 Subject: [PATCH 5/5] [FD-1831] Add kf to package.json --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index ae8a038..38b25ac 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "build-uat": "vite build --mode uat", "build-alpha": "vite build --mode alpha", "build-prod": "vite build --mode prod", + "build-kf": "vite build --mode kf", "lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0", "preview": "vite preview" },