From 33bda53364ad9cff8da153333e56acbfdc48628b Mon Sep 17 00:00:00 2001 From: Khanh Nguyen Date: Wed, 3 Jan 2024 18:09:59 -0800 Subject: [PATCH 01/11] New Cloud Build config for trigger for Firebase deploy on push to main. Currently deploys to a staging project for testing. --- cloud_build/deploy.yaml | 17 +++++++++++++++++ cloud_build/scripts/check_links_and_publish.sh | 10 ++++++++++ 2 files changed, 27 insertions(+) create mode 100644 cloud_build/deploy.yaml create mode 100644 cloud_build/scripts/check_links_and_publish.sh diff --git a/cloud_build/deploy.yaml b/cloud_build/deploy.yaml new file mode 100644 index 0000000000..f94ca7de03 --- /dev/null +++ b/cloud_build/deploy.yaml @@ -0,0 +1,17 @@ +steps: + - name: gcr.io/cloud-builders/git + args: ['submodule', 'update', '--init', '--recursive'] + - name: gcr.io/cloud-builders/docker + entrypoint: '/bin/bash' + args: + - '-c' + - |- + set -e + echo "Building the website using a makefile..." + make build + - name: gcr.io/flutter-dev-230821/firebase-staging + entrypoint: '/bin/bash' + args: + - '-c' + - |- + cloud_build/scripts/stage_site_and_comment_on_github.sh \ No newline at end of file diff --git a/cloud_build/scripts/check_links_and_publish.sh b/cloud_build/scripts/check_links_and_publish.sh new file mode 100644 index 0000000000..a7216ece7d --- /dev/null +++ b/cloud_build/scripts/check_links_and_publish.sh @@ -0,0 +1,10 @@ +#!/bin/bash +set -e + +# Check links are valid +tool/check-links.sh + +# Deploy to Firebase hosting +firebase deploy --project=flutter-website-staging --only=hosting + + From 30fcf519437caba88995ccb53bf44797933b6fc0 Mon Sep 17 00:00:00 2001 From: Khanh Nguyen Date: Wed, 3 Jan 2024 18:24:12 -0800 Subject: [PATCH 02/11] call check links and publish shell file --- cloud_build/deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloud_build/deploy.yaml b/cloud_build/deploy.yaml index f94ca7de03..0955cc1aa6 100644 --- a/cloud_build/deploy.yaml +++ b/cloud_build/deploy.yaml @@ -14,4 +14,4 @@ steps: args: - '-c' - |- - cloud_build/scripts/stage_site_and_comment_on_github.sh \ No newline at end of file + cloud_build/scripts/check_links_and_publish.sh \ No newline at end of file From 9060844f581d57579b6d9d0212bfa00f26700cea Mon Sep 17 00:00:00 2001 From: Khanh Nguyen Date: Wed, 3 Jan 2024 18:35:42 -0800 Subject: [PATCH 03/11] cloud logging only --- cloud_build/deploy.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cloud_build/deploy.yaml b/cloud_build/deploy.yaml index 0955cc1aa6..e56d65a56b 100644 --- a/cloud_build/deploy.yaml +++ b/cloud_build/deploy.yaml @@ -14,4 +14,6 @@ steps: args: - '-c' - |- - cloud_build/scripts/check_links_and_publish.sh \ No newline at end of file + cloud_build/scripts/check_links_and_publish.sh +options: + logging: CLOUD_LOGGING_ONLY \ No newline at end of file From abc2f34ef779955919dda20982d06ac74c06b8a5 Mon Sep 17 00:00:00 2001 From: Khanh Nguyen Date: Wed, 3 Jan 2024 18:41:28 -0800 Subject: [PATCH 04/11] allow execute --- cloud_build/scripts/check_links_and_publish.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 cloud_build/scripts/check_links_and_publish.sh diff --git a/cloud_build/scripts/check_links_and_publish.sh b/cloud_build/scripts/check_links_and_publish.sh old mode 100644 new mode 100755 From 50e0a42aedfd196fc5d2a9d91f56c444cd509a91 Mon Sep 17 00:00:00 2001 From: Khanh Nguyen Date: Wed, 3 Jan 2024 18:49:25 -0800 Subject: [PATCH 05/11] specify TOOL_DIR env --- cloud_build/scripts/check_links_and_publish.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/cloud_build/scripts/check_links_and_publish.sh b/cloud_build/scripts/check_links_and_publish.sh index a7216ece7d..f4395583b0 100755 --- a/cloud_build/scripts/check_links_and_publish.sh +++ b/cloud_build/scripts/check_links_and_publish.sh @@ -2,6 +2,7 @@ set -e # Check links are valid +TOOL_DIR=/tool tool/check-links.sh # Deploy to Firebase hosting From 7879cf9ad627203908e7d1a3ce1acb599d38545a Mon Sep 17 00:00:00 2001 From: Khanh Nguyen Date: Wed, 3 Jan 2024 18:55:14 -0800 Subject: [PATCH 06/11] export env variable --- cloud_build/scripts/check_links_and_publish.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloud_build/scripts/check_links_and_publish.sh b/cloud_build/scripts/check_links_and_publish.sh index f4395583b0..dc1d02042d 100755 --- a/cloud_build/scripts/check_links_and_publish.sh +++ b/cloud_build/scripts/check_links_and_publish.sh @@ -2,7 +2,7 @@ set -e # Check links are valid -TOOL_DIR=/tool +export TOOL_DIR=/tool tool/check-links.sh # Deploy to Firebase hosting From d9302dadb8ecf6945988ddd67c700cbd6b534b06 Mon Sep 17 00:00:00 2001 From: Khanh Nguyen Date: Wed, 3 Jan 2024 19:00:48 -0800 Subject: [PATCH 07/11] remove leading backslash --- cloud_build/scripts/check_links_and_publish.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloud_build/scripts/check_links_and_publish.sh b/cloud_build/scripts/check_links_and_publish.sh index dc1d02042d..02668099e9 100755 --- a/cloud_build/scripts/check_links_and_publish.sh +++ b/cloud_build/scripts/check_links_and_publish.sh @@ -2,7 +2,7 @@ set -e # Check links are valid -export TOOL_DIR=/tool +export TOOL_DIR=tool tool/check-links.sh # Deploy to Firebase hosting From 709e61269c3558718267f78c8135046276725069 Mon Sep 17 00:00:00 2001 From: Khanh Nguyen Date: Wed, 3 Jan 2024 19:09:26 -0800 Subject: [PATCH 08/11] remove check links --- cloud_build/scripts/check_links_and_publish.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/cloud_build/scripts/check_links_and_publish.sh b/cloud_build/scripts/check_links_and_publish.sh index 02668099e9..bab70d56cb 100755 --- a/cloud_build/scripts/check_links_and_publish.sh +++ b/cloud_build/scripts/check_links_and_publish.sh @@ -1,10 +1,6 @@ #!/bin/bash set -e -# Check links are valid -export TOOL_DIR=tool -tool/check-links.sh - # Deploy to Firebase hosting firebase deploy --project=flutter-website-staging --only=hosting From 6d115f0d8ccf9cd38763bf1c0988b32a3198639d Mon Sep 17 00:00:00 2001 From: Khanh Nguyen Date: Wed, 3 Jan 2024 19:14:42 -0800 Subject: [PATCH 09/11] consolidate into single file --- cloud_build/deploy.yaml | 2 +- cloud_build/scripts/check_links_and_publish.sh | 7 ------- 2 files changed, 1 insertion(+), 8 deletions(-) delete mode 100755 cloud_build/scripts/check_links_and_publish.sh diff --git a/cloud_build/deploy.yaml b/cloud_build/deploy.yaml index e56d65a56b..9f9d265b6b 100644 --- a/cloud_build/deploy.yaml +++ b/cloud_build/deploy.yaml @@ -14,6 +14,6 @@ steps: args: - '-c' - |- - cloud_build/scripts/check_links_and_publish.sh + firebase deploy --project=flutter-website-staging-349021 --only=hosting options: logging: CLOUD_LOGGING_ONLY \ No newline at end of file diff --git a/cloud_build/scripts/check_links_and_publish.sh b/cloud_build/scripts/check_links_and_publish.sh deleted file mode 100755 index bab70d56cb..0000000000 --- a/cloud_build/scripts/check_links_and_publish.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -set -e - -# Deploy to Firebase hosting -firebase deploy --project=flutter-website-staging --only=hosting - - From 399fd34a2c83397f58956a686512b37f71e693e8 Mon Sep 17 00:00:00 2001 From: Khanh Nguyen Date: Thu, 4 Jan 2024 13:27:49 -0800 Subject: [PATCH 10/11] Use firebase-ghcli to make all firebase deploys use the same container image --- cloud_build/deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloud_build/deploy.yaml b/cloud_build/deploy.yaml index 9f9d265b6b..6259e5ebdd 100644 --- a/cloud_build/deploy.yaml +++ b/cloud_build/deploy.yaml @@ -9,7 +9,7 @@ steps: set -e echo "Building the website using a makefile..." make build - - name: gcr.io/flutter-dev-230821/firebase-staging + - name: gcr.io/flutter-dev-230821/firebase-ghcli entrypoint: '/bin/bash' args: - '-c' From 272b809d317e35dfbeedbaae83b5e90ced968d8c Mon Sep 17 00:00:00 2001 From: Khanh Nguyen Date: Thu, 4 Jan 2024 13:36:10 -0800 Subject: [PATCH 11/11] add newline at end of file --- cloud_build/deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloud_build/deploy.yaml b/cloud_build/deploy.yaml index 6259e5ebdd..ee38730af7 100644 --- a/cloud_build/deploy.yaml +++ b/cloud_build/deploy.yaml @@ -16,4 +16,4 @@ steps: - |- firebase deploy --project=flutter-website-staging-349021 --only=hosting options: - logging: CLOUD_LOGGING_ONLY \ No newline at end of file + logging: CLOUD_LOGGING_ONLY