From bf424eefcd75496bbb3b6a6ef90a0ea95a4766a1 Mon Sep 17 00:00:00 2001 From: Jon Jensen Date: Fri, 3 Nov 2023 14:56:17 -0700 Subject: [PATCH 01/25] Deploy script --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 1d308c3..39b1af2 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,8 @@ "api:test": "node tests/http-test.js", "widget:build": "npm run build --workspace=widget", "widget:build:preview": "npm run build:preview --workspace=widget", - "serve": "node serve/stack-server.js" + "serve": "node serve/stack-server.js", + "deploy": "npx arc deploy --name test" }, "devDependencies": { "@architect/architect": "^10.14.2", From 5063ada79d8903a42eed7dad1611bc74ec15c4bd Mon Sep 17 00:00:00 2001 From: Jon Jensen Date: Tue, 7 Nov 2023 15:57:05 -0800 Subject: [PATCH 02/25] Update env-picker for stack PRs --- package.json | 2 +- utils/deploy.sh | 42 ++++++++++++++++++++++++++++++++ {serve => utils}/stack-server.js | 0 widget/preview/env-picker.js | 19 +++++++++++++-- widget/preview/generate.js | 25 +++++++++++-------- widget/preview/local.html | 1 - 6 files changed, 75 insertions(+), 14 deletions(-) create mode 100644 utils/deploy.sh rename {serve => utils}/stack-server.js (100%) diff --git a/package.json b/package.json index 39b1af2..52f3ded 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "api:test": "node tests/http-test.js", "widget:build": "npm run build --workspace=widget", "widget:build:preview": "npm run build:preview --workspace=widget", - "serve": "node serve/stack-server.js", + "serve": "node utils/stack-server.js", "deploy": "npx arc deploy --name test" }, "devDependencies": { diff --git a/utils/deploy.sh b/utils/deploy.sh new file mode 100644 index 0000000..7d744a2 --- /dev/null +++ b/utils/deploy.sh @@ -0,0 +1,42 @@ +#!/bin/sh + +#CODEBUILD_WEBHOOK_BASE_REF="refs/heads/the-branch" +#CODEBUILD_WEBHOOK_TRIGGER="pr/5" + +# Get the name for our arc.codes instance. +if [ -n $CODEBUILD_WEBHOOK_BASE_REF ] +then + # Strip "refs/heads/" from the GitHub ref. + BENEFITS_RECS_INSTANCE_NAME=$(echo ${CODEBUILD_WEBHOOK_BASE_REF/refs\/heads\//} | sed 's|[^A-Za-z0-9-]|-|g' | sed -E 's|-*([A-Za-z0-9]*.*[A-Za-z0-9]+)-*|\1|') +else + # Provide this default if we're testing and the PR info isn't available. + BENEFITS_RECS_INSTANCE_NAME="codebuild-test" +fi + +if [ -n $CODEBUILD_WEBHOOK_TRIGGER ] +then + # strip "pr/" from webhook trigger + BENEFITS_RECS_PR_NUMBER=${CODEBUILD_WEBHOOK_TRIGGER/pr\//} +fi + +echo "PR number: $BENEFITS_RECS_PR_NUMBER" +echo "Git branch: $BENEFITS_RECS_INSTANCE_NAME" + +# Attempt to deploy. tee streams the output. +#BENEFITS_RECS_DEPLOY_OUTPUT=$(npx arc deploy | tee /dev/stderr) +#BENEFITS_RECS_DEPLOY_STATUS=$? + +# If deployment failed, let's bail out here. +#if [ $BENEFITS_RECS_DEPLOY_STATUS -gt 0 ] +#then +# echo "\001$BENEFITS_RECS_DEPLOY_OUTPUT\002" +# exit $BENEFITS_RECS_DEPLOY_STATUS +#fi + +BENEFITS_RECS_DEPLOY_OUTPUT="✓ Success! Deployed app in 55.815 seconds + + https://7ksmy2xna5.execute-api.us-west-1.amazonaws.com +" + +BENEFITS_RECS_ENDPOINT_URL=$(echo "\001$BENEFITS_RECS_DEPLOY_OUTPUT\002" | tail -n 2 | xargs) +echo "\001Endpoint: $BENEFITS_RECS_ENDPOINT_URL\002" \ No newline at end of file diff --git a/serve/stack-server.js b/utils/stack-server.js similarity index 100% rename from serve/stack-server.js rename to utils/stack-server.js diff --git a/widget/preview/env-picker.js b/widget/preview/env-picker.js index 5ebd661..d50c07f 100644 --- a/widget/preview/env-picker.js +++ b/widget/preview/env-picker.js @@ -139,13 +139,23 @@ const getHostOptions = async () => { }); }; -const hydrateMenus = async () => { +const hydrateMenus = async (endpoint = undefined, branch = undefined) => { const menus = { ...defaultMenus }; const widget = document.querySelector("cagov-benefits-recs"); const hosts = (await getHostOptions()) || []; menus.host.options = [...menus.host.options, ...hosts]; + if (endpoint && branch) { + const extraEndpoint = { + id: branch, + value: endpoint, + text: branch, + }; + + menus.endpoint.options.push(extraEndpoint); + } + Object.keys(menus).forEach((key) => { const selObj = menus[key]; const currentValue = widget.hasAttribute(selObj.attribute) @@ -170,7 +180,12 @@ class EnvPicker extends window.HTMLElement { } async connectedCallback() { - const menus = await hydrateMenus(); + // this.endpoint and this.branch are not the currently active values for the widget. + // They're just extra, static values we can use to create an additional endpoint option. + this.endpoint = this.getAttribute("endpoint"); + this.branch = this.getAttribute("branch"); + + const menus = await hydrateMenus(this.endpoint, this.branch); this.menus = menus; const initialHtml = generateHtml(this.menus); diff --git a/widget/preview/generate.js b/widget/preview/generate.js index 665700d..d5b69ea 100644 --- a/widget/preview/generate.js +++ b/widget/preview/generate.js @@ -1,10 +1,15 @@ const fs = require("fs/promises"); const generate = (props) => { - const pr = props.prNumber - ? `(Pull Request #${props.prNumber})` + const { prNumber, endpointUrl, branchName } = props; + + const prLink = prNumber + ? `(Pull Request #${props.prNumber})` : ""; + const endpointAttribute = endpointUrl ? `endpoint="${endpointUrl}"` : ""; + const branchNameAttribute = branchName ? `branch="${branchName}"` : ""; + return /* html */ ` @@ -19,17 +24,15 @@ const generate = (props) => {

Benefits Recommender Preview

-

Widget branch: ${props.widgetEnv} ${pr}

- +

Widget branch: ${branchName} ${prLink}

+

Here's some test content.

The widget follows.

- - +

Site content runs below the widget too.

@@ -43,16 +46,18 @@ const generate = (props) => { (async () => { // CLI: - // node generate.js WIDGET-BRANCH PR-NUMBER + // node generate.js GIT-BRANCH PR-NUMBER // node generate.js my-upcoming-change-branch 12 const args = process.argv; - const widgetEnv = args[2] || "main"; + const branchName = args[2] || "main"; const prNumber = args[3] || undefined; + const endpointUrl = args[4] || undefined; const html = generate({ - widgetEnv, + branchName, prNumber, + endpointUrl, }); await fs.mkdir("dist/preview", { recursive: true }); diff --git a/widget/preview/local.html b/widget/preview/local.html index bea4f2f..eefbe1c 100644 --- a/widget/preview/local.html +++ b/widget/preview/local.html @@ -20,7 +20,6 @@

Benefits Recommender Preview

From 91ed220e0464a974e6064fc3f9b46be798c7e64d Mon Sep 17 00:00:00 2001 From: Jon Jensen Date: Tue, 7 Nov 2023 16:10:29 -0800 Subject: [PATCH 03/25] Shell script substitution changes --- utils/deploy.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/utils/deploy.sh b/utils/deploy.sh index 7d744a2..4274a48 100644 --- a/utils/deploy.sh +++ b/utils/deploy.sh @@ -1,13 +1,13 @@ #!/bin/sh -#CODEBUILD_WEBHOOK_BASE_REF="refs/heads/the-branch" -#CODEBUILD_WEBHOOK_TRIGGER="pr/5" +# CODEBUILD_WEBHOOK_BASE_REF="refs/heads/the-branch" +# CODEBUILD_WEBHOOK_TRIGGER="pr/5" # Get the name for our arc.codes instance. if [ -n $CODEBUILD_WEBHOOK_BASE_REF ] then # Strip "refs/heads/" from the GitHub ref. - BENEFITS_RECS_INSTANCE_NAME=$(echo ${CODEBUILD_WEBHOOK_BASE_REF/refs\/heads\//} | sed 's|[^A-Za-z0-9-]|-|g' | sed -E 's|-*([A-Za-z0-9]*.*[A-Za-z0-9]+)-*|\1|') + BENEFITS_RECS_INSTANCE_NAME=$(echo ${CODEBUILD_WEBHOOK_BASE_REF#refs\/heads\/} | sed 's|[^A-Za-z0-9-]|-|g' | sed -E 's|-*([A-Za-z0-9]*.*[A-Za-z0-9]+)-*|\1|') else # Provide this default if we're testing and the PR info isn't available. BENEFITS_RECS_INSTANCE_NAME="codebuild-test" @@ -16,7 +16,7 @@ fi if [ -n $CODEBUILD_WEBHOOK_TRIGGER ] then # strip "pr/" from webhook trigger - BENEFITS_RECS_PR_NUMBER=${CODEBUILD_WEBHOOK_TRIGGER/pr\//} + BENEFITS_RECS_PR_NUMBER=${CODEBUILD_WEBHOOK_TRIGGER#pr\/} fi echo "PR number: $BENEFITS_RECS_PR_NUMBER" From 1253fdd0359f19462e4e1426480c1bad94e53440 Mon Sep 17 00:00:00 2001 From: Jon Jensen Date: Tue, 7 Nov 2023 16:14:47 -0800 Subject: [PATCH 04/25] Change deploy ref --- utils/deploy.sh | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/utils/deploy.sh b/utils/deploy.sh index 4274a48..901012a 100644 --- a/utils/deploy.sh +++ b/utils/deploy.sh @@ -1,13 +1,14 @@ #!/bin/sh -# CODEBUILD_WEBHOOK_BASE_REF="refs/heads/the-branch" -# CODEBUILD_WEBHOOK_TRIGGER="pr/5" +CODEBUILD_WEBHOOK_HEAD_REF="refs/heads/the-branch" +CODEBUILD_WEBHOOK_TRIGGER="pr/5" +BENEFITS_RECS_DEPLOY_OUTPUT="✓ Success! Deployed app in 55.815 seconds\n https://7ksmy2xna5.execute-api.us-west-1.amazonaws.com\n" # Get the name for our arc.codes instance. -if [ -n $CODEBUILD_WEBHOOK_BASE_REF ] +if [ -n $CODEBUILD_WEBHOOK_HEAD_REF ] then # Strip "refs/heads/" from the GitHub ref. - BENEFITS_RECS_INSTANCE_NAME=$(echo ${CODEBUILD_WEBHOOK_BASE_REF#refs\/heads\/} | sed 's|[^A-Za-z0-9-]|-|g' | sed -E 's|-*([A-Za-z0-9]*.*[A-Za-z0-9]+)-*|\1|') + BENEFITS_RECS_INSTANCE_NAME=$(echo ${CODEBUILD_WEBHOOK_HEAD_REF#refs\/heads\/} | sed 's|[^A-Za-z0-9-]|-|g' | sed -E 's|-*([A-Za-z0-9]*.*[A-Za-z0-9]+)-*|\1|') else # Provide this default if we're testing and the PR info isn't available. BENEFITS_RECS_INSTANCE_NAME="codebuild-test" @@ -33,10 +34,5 @@ echo "Git branch: $BENEFITS_RECS_INSTANCE_NAME" # exit $BENEFITS_RECS_DEPLOY_STATUS #fi -BENEFITS_RECS_DEPLOY_OUTPUT="✓ Success! Deployed app in 55.815 seconds - - https://7ksmy2xna5.execute-api.us-west-1.amazonaws.com -" - BENEFITS_RECS_ENDPOINT_URL=$(echo "\001$BENEFITS_RECS_DEPLOY_OUTPUT\002" | tail -n 2 | xargs) -echo "\001Endpoint: $BENEFITS_RECS_ENDPOINT_URL\002" \ No newline at end of file +echo "Endpoint: $BENEFITS_RECS_ENDPOINT_URL" \ No newline at end of file From dc15b35f4c7b7dae4db3e506ccd1413e5a1ae8c7 Mon Sep 17 00:00:00 2001 From: Jon Jensen Date: Tue, 7 Nov 2023 16:15:24 -0800 Subject: [PATCH 05/25] Hide dev vars --- utils/deploy.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/deploy.sh b/utils/deploy.sh index 901012a..d828ecd 100644 --- a/utils/deploy.sh +++ b/utils/deploy.sh @@ -1,7 +1,7 @@ #!/bin/sh -CODEBUILD_WEBHOOK_HEAD_REF="refs/heads/the-branch" -CODEBUILD_WEBHOOK_TRIGGER="pr/5" +# CODEBUILD_WEBHOOK_HEAD_REF="refs/heads/the-branch" +# CODEBUILD_WEBHOOK_TRIGGER="pr/5" BENEFITS_RECS_DEPLOY_OUTPUT="✓ Success! Deployed app in 55.815 seconds\n https://7ksmy2xna5.execute-api.us-west-1.amazonaws.com\n" # Get the name for our arc.codes instance. From 800002f053b08a14b727b958a65ae6c7c2243066 Mon Sep 17 00:00:00 2001 From: Jon Jensen Date: Tue, 7 Nov 2023 18:06:08 -0800 Subject: [PATCH 06/25] Turn on deployment from script --- .github/workflows/deploy_pr.yml | 34 ++-------------------------- utils/deploy.sh | 39 ++++++++++++++++++++++----------- 2 files changed, 28 insertions(+), 45 deletions(-) diff --git a/.github/workflows/deploy_pr.yml b/.github/workflows/deploy_pr.yml index 84f7343..41a3ef4 100644 --- a/.github/workflows/deploy_pr.yml +++ b/.github/workflows/deploy_pr.yml @@ -13,13 +13,6 @@ jobs: permissions: pull-requests: write steps: - - uses: actions/checkout@v3 - - - name: Use Node.js - uses: actions/setup-node@v3 - with: - node-version: 18 - - name: Get branch name (merge) if: github.event_name != 'pull_request' shell: bash @@ -38,32 +31,9 @@ jobs: shell: bash run: echo ${URLSAFE_BRANCH_NAME} - - name: Build - run: | - npm install - npm run widget:build - npm run widget:build:preview -- ${URLSAFE_BRANCH_NAME} ${PRNum} - env: - PRNum: ${{ github.event.number }} - - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v4 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: us-west-1 - - - name: Deploy to S3 - run: aws s3 sync ./widget/dist s3://staging.cdn.innovation.ca.gov/br/pr/${URLSAFE_BRANCH_NAME} --follow-symlinks - - - name: Invalidate Cloudfront - env: - AWS_RETRY_MODE: standard - AWS_MAX_ATTEMPTS: 6 - run: aws cloudfront create-invalidation --distribution-id EPGKQG9OR4C9S --paths "/br/*" - - name: Post URL to PR uses: mshick/add-pr-comment@v2 with: message: | - [Widget preview available](https://staging.cdn.innovation.ca.gov/br/pr/${{ env.URLSAFE_BRANCH_NAME }}/preview/index.html). + [Widget preview page.](https://staging.cdn.innovation.ca.gov/br/pr/${{ env.URLSAFE_BRANCH_NAME }}/preview/index.html) + (You may need to wait a minute or two for the latest preview at the above page.) diff --git a/utils/deploy.sh b/utils/deploy.sh index d828ecd..b1a7bd3 100644 --- a/utils/deploy.sh +++ b/utils/deploy.sh @@ -1,21 +1,24 @@ #!/bin/sh +# Useful variables for development... # CODEBUILD_WEBHOOK_HEAD_REF="refs/heads/the-branch" # CODEBUILD_WEBHOOK_TRIGGER="pr/5" -BENEFITS_RECS_DEPLOY_OUTPUT="✓ Success! Deployed app in 55.815 seconds\n https://7ksmy2xna5.execute-api.us-west-1.amazonaws.com\n" +# BENEFITS_RECS_DEPLOY_OUTPUT="✓ Success! Deployed app in 55.815 seconds\n https://7ksmy2xna5.execute-api.us-west-1.amazonaws.com\n" # Get the name for our arc.codes instance. -if [ -n $CODEBUILD_WEBHOOK_HEAD_REF ] +if [ -z $CODEBUILD_WEBHOOK_HEAD_REF ] then - # Strip "refs/heads/" from the GitHub ref. - BENEFITS_RECS_INSTANCE_NAME=$(echo ${CODEBUILD_WEBHOOK_HEAD_REF#refs\/heads\/} | sed 's|[^A-Za-z0-9-]|-|g' | sed -E 's|-*([A-Za-z0-9]*.*[A-Za-z0-9]+)-*|\1|') -else # Provide this default if we're testing and the PR info isn't available. BENEFITS_RECS_INSTANCE_NAME="codebuild-test" +else + # Strip "refs/heads/" from the GitHub ref. + BENEFITS_RECS_INSTANCE_NAME=$(echo ${CODEBUILD_WEBHOOK_HEAD_REF#refs\/heads\/} | sed 's|[^A-Za-z0-9-]|-|g' | sed -E 's|-*([A-Za-z0-9]*.*[A-Za-z0-9]+)-*|\1|') fi if [ -n $CODEBUILD_WEBHOOK_TRIGGER ] then + BENEFITS_RECS_PR_NUMBER="9999" +else # strip "pr/" from webhook trigger BENEFITS_RECS_PR_NUMBER=${CODEBUILD_WEBHOOK_TRIGGER#pr\/} fi @@ -24,15 +27,25 @@ echo "PR number: $BENEFITS_RECS_PR_NUMBER" echo "Git branch: $BENEFITS_RECS_INSTANCE_NAME" # Attempt to deploy. tee streams the output. -#BENEFITS_RECS_DEPLOY_OUTPUT=$(npx arc deploy | tee /dev/stderr) -#BENEFITS_RECS_DEPLOY_STATUS=$? +BENEFITS_RECS_DEPLOY_OUTPUT=$(npx arc deploy --name $BENEFITS_RECS_INSTANCE_NAME | tee /dev/stderr) +BENEFITS_RECS_DEPLOY_STATUS=$? # If deployment failed, let's bail out here. -#if [ $BENEFITS_RECS_DEPLOY_STATUS -gt 0 ] -#then -# echo "\001$BENEFITS_RECS_DEPLOY_OUTPUT\002" -# exit $BENEFITS_RECS_DEPLOY_STATUS -#fi +if [ $BENEFITS_RECS_DEPLOY_STATUS -gt 0 ] +then + echo "\001$BENEFITS_RECS_DEPLOY_OUTPUT\002" + exit $BENEFITS_RECS_DEPLOY_STATUS +fi BENEFITS_RECS_ENDPOINT_URL=$(echo "\001$BENEFITS_RECS_DEPLOY_OUTPUT\002" | tail -n 2 | xargs) -echo "Endpoint: $BENEFITS_RECS_ENDPOINT_URL" \ No newline at end of file +echo "Endpoint: $BENEFITS_RECS_ENDPOINT_URL" + +npm run widget:build:preview -- $BENEFITS_RECS_INSTANCE_NAME $BENEFITS_RECS_PR_NUMBER $BENEFITS_RECS_ENDPOINT_URL + +echo "\n> Uploading to S3." +aws s3 sync ./widget/dist s3://staging.cdn.innovation.ca.gov/br/pr/$BENEFITS_RECS_INSTANCE_NAME --follow-symlinks + +echo "\n> Sending invalidation to Cloudfront cache." +AWS_PAGER="" aws cloudfront create-invalidation --distribution-id EPGKQG9OR4C9S --paths "/br/*" + +echo "\nPreview: https://staging.cdn.innovation.ca.gov/br/pr/$BENEFITS_RECS_INSTANCE_NAME/preview/index.html" \ No newline at end of file From 7ec3f93de7f53e1d850ecdf3fd892c247ea598d7 Mon Sep 17 00:00:00 2001 From: Jon Jensen Date: Tue, 7 Nov 2023 18:25:30 -0800 Subject: [PATCH 07/25] Add line break --- .github/workflows/deploy_pr.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/deploy_pr.yml b/.github/workflows/deploy_pr.yml index 41a3ef4..92dcd1d 100644 --- a/.github/workflows/deploy_pr.yml +++ b/.github/workflows/deploy_pr.yml @@ -36,4 +36,5 @@ jobs: with: message: | [Widget preview page.](https://staging.cdn.innovation.ca.gov/br/pr/${{ env.URLSAFE_BRANCH_NAME }}/preview/index.html) + (You may need to wait a minute or two for the latest preview at the above page.) From 465921473acbea39d3d9e15d3cc999f9e05fe597 Mon Sep 17 00:00:00 2001 From: Jon Jensen Date: Wed, 8 Nov 2023 11:23:37 -0800 Subject: [PATCH 08/25] Update copy --- .github/workflows/deploy_pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy_pr.yml b/.github/workflows/deploy_pr.yml index 92dcd1d..2a4fd7a 100644 --- a/.github/workflows/deploy_pr.yml +++ b/.github/workflows/deploy_pr.yml @@ -37,4 +37,4 @@ jobs: message: | [Widget preview page.](https://staging.cdn.innovation.ca.gov/br/pr/${{ env.URLSAFE_BRANCH_NAME }}/preview/index.html) - (You may need to wait a minute or two for the latest preview at the above page.) + (You may need to wait a minute or two for the latest preview to appear at the above link.) From 9008c1cd91120f9ad08eadb16d233132c3e0af44 Mon Sep 17 00:00:00 2001 From: Jon Jensen Date: Wed, 8 Nov 2023 11:29:43 -0800 Subject: [PATCH 09/25] Remove tee streaming --- utils/deploy.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/deploy.sh b/utils/deploy.sh index b1a7bd3..8250abb 100644 --- a/utils/deploy.sh +++ b/utils/deploy.sh @@ -26,8 +26,8 @@ fi echo "PR number: $BENEFITS_RECS_PR_NUMBER" echo "Git branch: $BENEFITS_RECS_INSTANCE_NAME" -# Attempt to deploy. tee streams the output. -BENEFITS_RECS_DEPLOY_OUTPUT=$(npx arc deploy --name $BENEFITS_RECS_INSTANCE_NAME | tee /dev/stderr) +# Attempt to deploy. This will appear to hang. Just wait for it. +BENEFITS_RECS_DEPLOY_OUTPUT=$(npx arc deploy --name $BENEFITS_RECS_INSTANCE_NAME) BENEFITS_RECS_DEPLOY_STATUS=$? # If deployment failed, let's bail out here. From 0b4fcfe72d590dd5b09eb4a55e5bdae1c1ff95f7 Mon Sep 17 00:00:00 2001 From: Jon Jensen Date: Wed, 8 Nov 2023 11:45:38 -0800 Subject: [PATCH 10/25] Small fixes --- utils/deploy.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/deploy.sh b/utils/deploy.sh index 8250abb..8cd8e67 100644 --- a/utils/deploy.sh +++ b/utils/deploy.sh @@ -15,7 +15,7 @@ else BENEFITS_RECS_INSTANCE_NAME=$(echo ${CODEBUILD_WEBHOOK_HEAD_REF#refs\/heads\/} | sed 's|[^A-Za-z0-9-]|-|g' | sed -E 's|-*([A-Za-z0-9]*.*[A-Za-z0-9]+)-*|\1|') fi -if [ -n $CODEBUILD_WEBHOOK_TRIGGER ] +if [ -z $CODEBUILD_WEBHOOK_TRIGGER ] then BENEFITS_RECS_PR_NUMBER="9999" else @@ -37,7 +37,7 @@ then exit $BENEFITS_RECS_DEPLOY_STATUS fi -BENEFITS_RECS_ENDPOINT_URL=$(echo "\001$BENEFITS_RECS_DEPLOY_OUTPUT\002" | tail -n 2 | xargs) +BENEFITS_RECS_ENDPOINT_URL=$(echo "$BENEFITS_RECS_DEPLOY_OUTPUT" | tail -n 2 | xargs) echo "Endpoint: $BENEFITS_RECS_ENDPOINT_URL" npm run widget:build:preview -- $BENEFITS_RECS_INSTANCE_NAME $BENEFITS_RECS_PR_NUMBER $BENEFITS_RECS_ENDPOINT_URL From 1468a6c9a1291349a790c62ff985daf0ff5f4164 Mon Sep 17 00:00:00 2001 From: Jon Jensen Date: Wed, 8 Nov 2023 11:50:58 -0800 Subject: [PATCH 11/25] Change scope of PR preview GH Action --- .github/workflows/deploy_pr.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/deploy_pr.yml b/.github/workflows/deploy_pr.yml index 2a4fd7a..5082b8b 100644 --- a/.github/workflows/deploy_pr.yml +++ b/.github/workflows/deploy_pr.yml @@ -1,11 +1,8 @@ -name: PR preview deployment +name: PR preview notification on: pull_request: types: - opened - - synchronize - - ready_for_review - - reopened jobs: build_deploy: From 5e19020f4c3d2ec013a4ca01451b97264193508e Mon Sep 17 00:00:00 2001 From: Jon Jensen Date: Wed, 8 Nov 2023 12:52:02 -0800 Subject: [PATCH 12/25] Check terminal output --- utils/deploy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/deploy.sh b/utils/deploy.sh index 8cd8e67..f547b5a 100644 --- a/utils/deploy.sh +++ b/utils/deploy.sh @@ -37,7 +37,7 @@ then exit $BENEFITS_RECS_DEPLOY_STATUS fi -BENEFITS_RECS_ENDPOINT_URL=$(echo "$BENEFITS_RECS_DEPLOY_OUTPUT" | tail -n 2 | xargs) +BENEFITS_RECS_ENDPOINT_URL=$(echo $BENEFITS_RECS_DEPLOY_OUTPUT | tail -n 2 | xargs) echo "Endpoint: $BENEFITS_RECS_ENDPOINT_URL" npm run widget:build:preview -- $BENEFITS_RECS_INSTANCE_NAME $BENEFITS_RECS_PR_NUMBER $BENEFITS_RECS_ENDPOINT_URL From 2dc469e43b166a3299f334999640dd357dd587e3 Mon Sep 17 00:00:00 2001 From: Jon Jensen Date: Wed, 8 Nov 2023 16:54:34 -0800 Subject: [PATCH 13/25] More deploy scripts --- utils/delete-pr.sh | 30 ++++++++++++++++++++++++++++++ utils/{deploy.sh => deploy-pr.sh} | 7 +++++-- utils/deploy-prod.sh | 20 ++++++++++++++++++++ 3 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 utils/delete-pr.sh rename utils/{deploy.sh => deploy-pr.sh} (91%) create mode 100644 utils/deploy-prod.sh diff --git a/utils/delete-pr.sh b/utils/delete-pr.sh new file mode 100644 index 0000000..012a9ec --- /dev/null +++ b/utils/delete-pr.sh @@ -0,0 +1,30 @@ +#!/bin/sh + +# Useful variables for development... +# CODEBUILD_WEBHOOK_HEAD_REF="refs/heads/the-branch" + +# Get the name for our arc.codes instance. +if [ -z "$CODEBUILD_WEBHOOK_HEAD_REF" ] +then + # Provide this default if we're testing and the PR info isn't available. + BENEFITS_RECS_INSTANCE_NAME="codebuild-test" +else + # Strip "refs/heads/" from the GitHub ref. + BENEFITS_RECS_INSTANCE_NAME=$(echo ${CODEBUILD_WEBHOOK_HEAD_REF#refs\/heads\/} | sed 's|[^A-Za-z0-9-]|-|g' | sed -E 's|-*([A-Za-z0-9]*.*[A-Za-z0-9]+)-*|\1|') +fi + +echo "\n> Deleting arc.codes app." +echo "Git branch: $BENEFITS_RECS_INSTANCE_NAME" + +# Attempt to delete. This will appear to hang. Just wait for it. +npx arc destroy --app benefits-recommendation-api --name $BENEFITS_RECS_INSTANCE_NAME --force + +if [ -n "$BENEFITS_RECS_INSTANCE_NAME" ] +then + echo "\n> Removing from S3." + aws s3 rm s3://staging.cdn.innovation.ca.gov/br/pr/$BENEFITS_RECS_INSTANCE_NAME/ --recursive +else + echo "Skipping S3 delete due to blank git branch name." +fi + +echo "App deleted." \ No newline at end of file diff --git a/utils/deploy.sh b/utils/deploy-pr.sh similarity index 91% rename from utils/deploy.sh rename to utils/deploy-pr.sh index f547b5a..7b9e68e 100644 --- a/utils/deploy.sh +++ b/utils/deploy-pr.sh @@ -6,7 +6,7 @@ # BENEFITS_RECS_DEPLOY_OUTPUT="✓ Success! Deployed app in 55.815 seconds\n https://7ksmy2xna5.execute-api.us-west-1.amazonaws.com\n" # Get the name for our arc.codes instance. -if [ -z $CODEBUILD_WEBHOOK_HEAD_REF ] +if [ -z "$CODEBUILD_WEBHOOK_HEAD_REF" ] then # Provide this default if we're testing and the PR info isn't available. BENEFITS_RECS_INSTANCE_NAME="codebuild-test" @@ -15,7 +15,7 @@ else BENEFITS_RECS_INSTANCE_NAME=$(echo ${CODEBUILD_WEBHOOK_HEAD_REF#refs\/heads\/} | sed 's|[^A-Za-z0-9-]|-|g' | sed -E 's|-*([A-Za-z0-9]*.*[A-Za-z0-9]+)-*|\1|') fi -if [ -z $CODEBUILD_WEBHOOK_TRIGGER ] +if [ -z "$CODEBUILD_WEBHOOK_TRIGGER" ] then BENEFITS_RECS_PR_NUMBER="9999" else @@ -23,6 +23,7 @@ else BENEFITS_RECS_PR_NUMBER=${CODEBUILD_WEBHOOK_TRIGGER#pr\/} fi +echo "\n> Deploying arc.codes app." echo "PR number: $BENEFITS_RECS_PR_NUMBER" echo "Git branch: $BENEFITS_RECS_INSTANCE_NAME" @@ -40,6 +41,8 @@ fi BENEFITS_RECS_ENDPOINT_URL=$(echo $BENEFITS_RECS_DEPLOY_OUTPUT | tail -n 2 | xargs) echo "Endpoint: $BENEFITS_RECS_ENDPOINT_URL" +echo "\n> Generating front-end preview assets." +npm run widget:build npm run widget:build:preview -- $BENEFITS_RECS_INSTANCE_NAME $BENEFITS_RECS_PR_NUMBER $BENEFITS_RECS_ENDPOINT_URL echo "\n> Uploading to S3." diff --git a/utils/deploy-prod.sh b/utils/deploy-prod.sh new file mode 100644 index 0000000..def875c --- /dev/null +++ b/utils/deploy-prod.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +echo "\n> Deploying arc.codes app to production." +# Attempt to deploy. This will appear to hang. Just wait for it. +npx arc deploy --production + +echo "\n> Generating front-end preview assets." +npm run widget:build +npm run widget:build:preview + +echo "\n> Uploading to S3." +aws s3 sync ./widget/dist s3://cdn.innovation.ca.gov/br/ --follow-symlinks + +echo "\n> Sending invalidation to Cloudfront cache." +AWS_RETRY_MODE="standard" +AWS_MAX_ATTEMPTS=6 +AWS_PAGER="" +aws cloudfront create-invalidation --distribution-id EAQBFZOLKQ2AZ --paths "/br/*" + +echo "\nApp deployed to production." \ No newline at end of file From 90de2a1bc0e9f1623ca8484dfa7aaee966621793 Mon Sep 17 00:00:00 2001 From: Jon Jensen Date: Wed, 8 Nov 2023 17:00:50 -0800 Subject: [PATCH 14/25] Fix script --- utils/deploy-pr.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/deploy-pr.sh b/utils/deploy-pr.sh index 7b9e68e..a751d6a 100644 --- a/utils/deploy-pr.sh +++ b/utils/deploy-pr.sh @@ -38,7 +38,7 @@ then exit $BENEFITS_RECS_DEPLOY_STATUS fi -BENEFITS_RECS_ENDPOINT_URL=$(echo $BENEFITS_RECS_DEPLOY_OUTPUT | tail -n 2 | xargs) +BENEFITS_RECS_ENDPOINT_URL=$(echo "\001$BENEFITS_RECS_DEPLOY_OUTPUT\002" | tail -n 2 | xargs) echo "Endpoint: $BENEFITS_RECS_ENDPOINT_URL" echo "\n> Generating front-end preview assets." From f2d68dac5bbbcb77548053f6520e8e1401bcf5b1 Mon Sep 17 00:00:00 2001 From: Jon Jensen Date: Wed, 8 Nov 2023 18:53:32 -0800 Subject: [PATCH 15/25] Remove ANSI control chars --- utils/deploy-pr.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/deploy-pr.sh b/utils/deploy-pr.sh index a751d6a..3db3023 100644 --- a/utils/deploy-pr.sh +++ b/utils/deploy-pr.sh @@ -38,7 +38,7 @@ then exit $BENEFITS_RECS_DEPLOY_STATUS fi -BENEFITS_RECS_ENDPOINT_URL=$(echo "\001$BENEFITS_RECS_DEPLOY_OUTPUT\002" | tail -n 2 | xargs) +BENEFITS_RECS_ENDPOINT_URL=$(echo "\001$BENEFITS_RECS_DEPLOY_OUTPUT\002" | tail -n 2 | xargs | sed "s,\x1B\[[0-9;]*[a-zA-Z],,g") echo "Endpoint: $BENEFITS_RECS_ENDPOINT_URL" echo "\n> Generating front-end preview assets." From 17b81b5ae8472a44fdc079021654ae24549f970c Mon Sep 17 00:00:00 2001 From: Jon Jensen Date: Wed, 8 Nov 2023 19:08:44 -0800 Subject: [PATCH 16/25] Second attempt at ANSI escape chars --- utils/deploy-pr.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/deploy-pr.sh b/utils/deploy-pr.sh index 3db3023..f65c3b4 100644 --- a/utils/deploy-pr.sh +++ b/utils/deploy-pr.sh @@ -34,11 +34,11 @@ BENEFITS_RECS_DEPLOY_STATUS=$? # If deployment failed, let's bail out here. if [ $BENEFITS_RECS_DEPLOY_STATUS -gt 0 ] then - echo "\001$BENEFITS_RECS_DEPLOY_OUTPUT\002" + echo "\x01$BENEFITS_RECS_DEPLOY_OUTPUT\x02" exit $BENEFITS_RECS_DEPLOY_STATUS fi -BENEFITS_RECS_ENDPOINT_URL=$(echo "\001$BENEFITS_RECS_DEPLOY_OUTPUT\002" | tail -n 2 | xargs | sed "s,\x1B\[[0-9;]*[a-zA-Z],,g") +BENEFITS_RECS_ENDPOINT_URL=$(echo "\x01$BENEFITS_RECS_DEPLOY_OUTPUT\x02" | tail -n 2 | xargs | sed $"s,\x1B\[[0-9;]*[a-zA-Z],,g") echo "Endpoint: $BENEFITS_RECS_ENDPOINT_URL" echo "\n> Generating front-end preview assets." From 75506238873772d02571f8aede0cd443e7486411 Mon Sep 17 00:00:00 2001 From: Jon Jensen Date: Wed, 8 Nov 2023 19:15:57 -0800 Subject: [PATCH 17/25] Without sed --- utils/deploy-pr.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/deploy-pr.sh b/utils/deploy-pr.sh index f65c3b4..0ef1787 100644 --- a/utils/deploy-pr.sh +++ b/utils/deploy-pr.sh @@ -34,11 +34,11 @@ BENEFITS_RECS_DEPLOY_STATUS=$? # If deployment failed, let's bail out here. if [ $BENEFITS_RECS_DEPLOY_STATUS -gt 0 ] then - echo "\x01$BENEFITS_RECS_DEPLOY_OUTPUT\x02" + echo "$BENEFITS_RECS_DEPLOY_OUTPUT" exit $BENEFITS_RECS_DEPLOY_STATUS fi -BENEFITS_RECS_ENDPOINT_URL=$(echo "\x01$BENEFITS_RECS_DEPLOY_OUTPUT\x02" | tail -n 2 | xargs | sed $"s,\x1B\[[0-9;]*[a-zA-Z],,g") +BENEFITS_RECS_ENDPOINT_URL=$(echo "$BENEFITS_RECS_DEPLOY_OUTPUT" | tail -n 2 | xargs ) echo "Endpoint: $BENEFITS_RECS_ENDPOINT_URL" echo "\n> Generating front-end preview assets." From 4ca738d05d43741019c72acf6381100657fbfc88 Mon Sep 17 00:00:00 2001 From: Jon Jensen Date: Wed, 8 Nov 2023 21:40:40 -0800 Subject: [PATCH 18/25] Another attempt --- utils/deploy-pr.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/deploy-pr.sh b/utils/deploy-pr.sh index 0ef1787..b254d10 100644 --- a/utils/deploy-pr.sh +++ b/utils/deploy-pr.sh @@ -38,7 +38,7 @@ then exit $BENEFITS_RECS_DEPLOY_STATUS fi -BENEFITS_RECS_ENDPOINT_URL=$(echo "$BENEFITS_RECS_DEPLOY_OUTPUT" | tail -n 2 | xargs ) +BENEFITS_RECS_ENDPOINT_URL=$(echo "$BENEFITS_RECS_DEPLOY_OUTPUT" | tail -n 2 | xargs | sed 's/·\[\?25h//g') echo "Endpoint: $BENEFITS_RECS_ENDPOINT_URL" echo "\n> Generating front-end preview assets." From 63408f10b54397855e06295cef5a2333376b1d2b Mon Sep 17 00:00:00 2001 From: Jon Jensen Date: Wed, 8 Nov 2023 21:46:46 -0800 Subject: [PATCH 19/25] Getting closer --- utils/deploy-pr.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/deploy-pr.sh b/utils/deploy-pr.sh index b254d10..dc17121 100644 --- a/utils/deploy-pr.sh +++ b/utils/deploy-pr.sh @@ -38,7 +38,7 @@ then exit $BENEFITS_RECS_DEPLOY_STATUS fi -BENEFITS_RECS_ENDPOINT_URL=$(echo "$BENEFITS_RECS_DEPLOY_OUTPUT" | tail -n 2 | xargs | sed 's/·\[\?25h//g') +BENEFITS_RECS_ENDPOINT_URL=$(echo "$BENEFITS_RECS_DEPLOY_OUTPUT" | tail -n 2 | xargs | sed 's/\\x1B\[\?25h//g') echo "Endpoint: $BENEFITS_RECS_ENDPOINT_URL" echo "\n> Generating front-end preview assets." From bcf38fc081c0b3c54e1ed8fa62bc28dc2f38287c Mon Sep 17 00:00:00 2001 From: Jon Jensen Date: Thu, 9 Nov 2023 10:48:02 -0800 Subject: [PATCH 20/25] Another try --- utils/deploy-pr.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/deploy-pr.sh b/utils/deploy-pr.sh index dc17121..16f42d4 100644 --- a/utils/deploy-pr.sh +++ b/utils/deploy-pr.sh @@ -39,7 +39,7 @@ then fi BENEFITS_RECS_ENDPOINT_URL=$(echo "$BENEFITS_RECS_DEPLOY_OUTPUT" | tail -n 2 | xargs | sed 's/\\x1B\[\?25h//g') -echo "Endpoint: $BENEFITS_RECS_ENDPOINT_URL" +printf "Endpoint: %s" $BENEFITS_RECS_ENDPOINT_URL echo "\n> Generating front-end preview assets." npm run widget:build From f096b632632a2efba0a473cd1733b7053db3f8eb Mon Sep 17 00:00:00 2001 From: Jon Jensen Date: Thu, 9 Nov 2023 10:53:39 -0800 Subject: [PATCH 21/25] Add tags --- utils/deploy-pr.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/utils/deploy-pr.sh b/utils/deploy-pr.sh index 16f42d4..71f9c59 100644 --- a/utils/deploy-pr.sh +++ b/utils/deploy-pr.sh @@ -28,7 +28,7 @@ echo "PR number: $BENEFITS_RECS_PR_NUMBER" echo "Git branch: $BENEFITS_RECS_INSTANCE_NAME" # Attempt to deploy. This will appear to hang. Just wait for it. -BENEFITS_RECS_DEPLOY_OUTPUT=$(npx arc deploy --name $BENEFITS_RECS_INSTANCE_NAME) +BENEFITS_RECS_DEPLOY_OUTPUT=$(npx arc deploy --name $BENEFITS_RECS_INSTANCE_NAME --tags odieng=benefts-recommender --tags env=pr-preview) BENEFITS_RECS_DEPLOY_STATUS=$? # If deployment failed, let's bail out here. @@ -39,7 +39,7 @@ then fi BENEFITS_RECS_ENDPOINT_URL=$(echo "$BENEFITS_RECS_DEPLOY_OUTPUT" | tail -n 2 | xargs | sed 's/\\x1B\[\?25h//g') -printf "Endpoint: %s" $BENEFITS_RECS_ENDPOINT_URL +# echo "Endpoint: $BENEFITS_RECS_ENDPOINT_URL" echo "\n> Generating front-end preview assets." npm run widget:build @@ -49,6 +49,9 @@ echo "\n> Uploading to S3." aws s3 sync ./widget/dist s3://staging.cdn.innovation.ca.gov/br/pr/$BENEFITS_RECS_INSTANCE_NAME --follow-symlinks echo "\n> Sending invalidation to Cloudfront cache." -AWS_PAGER="" aws cloudfront create-invalidation --distribution-id EPGKQG9OR4C9S --paths "/br/*" +AWS_PAGER="" +AWS_RETRY_MODE="standard" +AWS_MAX_ATTEMPTS=6 +aws cloudfront create-invalidation --distribution-id EPGKQG9OR4C9S --paths "/br/*" echo "\nPreview: https://staging.cdn.innovation.ca.gov/br/pr/$BENEFITS_RECS_INSTANCE_NAME/preview/index.html" \ No newline at end of file From e7e6ee4addafa395627321fc350b398644b2ff64 Mon Sep 17 00:00:00 2001 From: Jon Jensen Date: Thu, 9 Nov 2023 11:00:50 -0800 Subject: [PATCH 22/25] One more ansi test --- utils/deploy-pr.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/utils/deploy-pr.sh b/utils/deploy-pr.sh index 71f9c59..c926eea 100644 --- a/utils/deploy-pr.sh +++ b/utils/deploy-pr.sh @@ -15,6 +15,7 @@ else BENEFITS_RECS_INSTANCE_NAME=$(echo ${CODEBUILD_WEBHOOK_HEAD_REF#refs\/heads\/} | sed 's|[^A-Za-z0-9-]|-|g' | sed -E 's|-*([A-Za-z0-9]*.*[A-Za-z0-9]+)-*|\1|') fi +# Get the PR number. if [ -z "$CODEBUILD_WEBHOOK_TRIGGER" ] then BENEFITS_RECS_PR_NUMBER="9999" @@ -39,7 +40,9 @@ then fi BENEFITS_RECS_ENDPOINT_URL=$(echo "$BENEFITS_RECS_DEPLOY_OUTPUT" | tail -n 2 | xargs | sed 's/\\x1B\[\?25h//g') -# echo "Endpoint: $BENEFITS_RECS_ENDPOINT_URL" +echo " <= weird ANSI escape output from capturing the deploy logs." + +echo "Endpoint: $BENEFITS_RECS_ENDPOINT_URL" echo "\n> Generating front-end preview assets." npm run widget:build From 0a355cee3c61ac5f3b77e7de18e4264fea83f84e Mon Sep 17 00:00:00 2001 From: Jon Jensen Date: Thu, 9 Nov 2023 11:22:42 -0800 Subject: [PATCH 23/25] Tag edits --- utils/deploy-pr.sh | 4 ++-- utils/deploy-prod.sh | 2 +- utils/{delete-pr.sh => destroy-pr.sh} | 0 widget/preview/generate.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) rename utils/{delete-pr.sh => destroy-pr.sh} (100%) diff --git a/utils/deploy-pr.sh b/utils/deploy-pr.sh index c926eea..d9b2471 100644 --- a/utils/deploy-pr.sh +++ b/utils/deploy-pr.sh @@ -29,7 +29,7 @@ echo "PR number: $BENEFITS_RECS_PR_NUMBER" echo "Git branch: $BENEFITS_RECS_INSTANCE_NAME" # Attempt to deploy. This will appear to hang. Just wait for it. -BENEFITS_RECS_DEPLOY_OUTPUT=$(npx arc deploy --name $BENEFITS_RECS_INSTANCE_NAME --tags odieng=benefts-recommender --tags env=pr-preview) +BENEFITS_RECS_DEPLOY_OUTPUT=$(npx arc deploy --name $BENEFITS_RECS_INSTANCE_NAME --tags odieng=benefts-recommender --tags env=development) BENEFITS_RECS_DEPLOY_STATUS=$? # If deployment failed, let's bail out here. @@ -40,7 +40,7 @@ then fi BENEFITS_RECS_ENDPOINT_URL=$(echo "$BENEFITS_RECS_DEPLOY_OUTPUT" | tail -n 2 | xargs | sed 's/\\x1B\[\?25h//g') -echo " <= weird ANSI escape output from capturing the deploy logs." +echo " <= That's ANSI escape output from capturing the deploy logs." echo "Endpoint: $BENEFITS_RECS_ENDPOINT_URL" diff --git a/utils/deploy-prod.sh b/utils/deploy-prod.sh index def875c..569e84f 100644 --- a/utils/deploy-prod.sh +++ b/utils/deploy-prod.sh @@ -2,7 +2,7 @@ echo "\n> Deploying arc.codes app to production." # Attempt to deploy. This will appear to hang. Just wait for it. -npx arc deploy --production +npx arc deploy --production --tags odieng=benefts-recommender --tags env=production echo "\n> Generating front-end preview assets." npm run widget:build diff --git a/utils/delete-pr.sh b/utils/destroy-pr.sh similarity index 100% rename from utils/delete-pr.sh rename to utils/destroy-pr.sh diff --git a/widget/preview/generate.js b/widget/preview/generate.js index d5b69ea..99facb7 100644 --- a/widget/preview/generate.js +++ b/widget/preview/generate.js @@ -23,7 +23,7 @@ const generate = (props) => {
-

Benefits Recommender Preview

+

Benefits Recommender Preview!

Widget branch: ${branchName} ${prLink}

From 8c88b456fc7fc68e150f412b76bd4ae920542a54 Mon Sep 17 00:00:00 2001 From: Jon Jensen Date: Thu, 9 Nov 2023 11:53:01 -0800 Subject: [PATCH 24/25] Add branch tag --- utils/deploy-pr.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/deploy-pr.sh b/utils/deploy-pr.sh index d9b2471..5e22063 100644 --- a/utils/deploy-pr.sh +++ b/utils/deploy-pr.sh @@ -29,7 +29,7 @@ echo "PR number: $BENEFITS_RECS_PR_NUMBER" echo "Git branch: $BENEFITS_RECS_INSTANCE_NAME" # Attempt to deploy. This will appear to hang. Just wait for it. -BENEFITS_RECS_DEPLOY_OUTPUT=$(npx arc deploy --name $BENEFITS_RECS_INSTANCE_NAME --tags odieng=benefts-recommender --tags env=development) +BENEFITS_RECS_DEPLOY_OUTPUT=$(npx arc deploy --name $BENEFITS_RECS_INSTANCE_NAME --tags odieng=benefts-recommender --tags env=development --tags branch=$BENEFITS_RECS_INSTANCE_NAME) BENEFITS_RECS_DEPLOY_STATUS=$? # If deployment failed, let's bail out here. From d18370b3c54027b1d9002e3d55b4e20948b77ec0 Mon Sep 17 00:00:00 2001 From: Jon Jensen Date: Thu, 9 Nov 2023 12:13:49 -0800 Subject: [PATCH 25/25] Remove prod GH Action --- .github/workflows/deploy_prod.yml | 38 ------------------------------- 1 file changed, 38 deletions(-) delete mode 100644 .github/workflows/deploy_prod.yml diff --git a/.github/workflows/deploy_prod.yml b/.github/workflows/deploy_prod.yml deleted file mode 100644 index 4e6f1e3..0000000 --- a/.github/workflows/deploy_prod.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Production deployment -on: - push: - branches: - - main - -jobs: - build_deploy: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Use Node.js - uses: actions/setup-node@v3 - with: - node-version: 18 - - - name: Build - run: | - npm install - npm run widget:build - npm run widget:build:preview - - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v4 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: us-west-1 - - - name: Deploy to S3 - run: aws s3 sync ./widget/dist s3://cdn.innovation.ca.gov/br/ --follow-symlinks - - - name: Invalidate Cloudfront - env: - AWS_RETRY_MODE: standard - AWS_MAX_ATTEMPTS: 6 - run: aws cloudfront create-invalidation --distribution-id EAQBFZOLKQ2AZ --paths "/br/*"