From 3faa41d3ee52e9c3d088182cc6e7aed7ab40aee9 Mon Sep 17 00:00:00 2001 From: Jules Belveze <32683010+JulesBelveze@users.noreply.github.com> Date: Sat, 21 Sep 2024 10:39:12 +0200 Subject: [PATCH] [github/k8s] - feature: add dynamic client-facing URL to Docker builds (#7592) - Provide `dust-client-facing-url` as a build argument across various GitHub Actions for Docker image builds - Enable dynamic setting of the client-facing URL environment variable during cloud builds for Docker images - Update cloudbuild.yaml to accept the `_DUST_CLIENT_FACING_URL` substitution and set the `NEXT_PUBLIC_DUST_CLIENT_FACING_URL` build argument accordingly Co-authored-by: Jules --- .github/workflows/deploy-alerting-temporal.yml | 2 +- .github/workflows/deploy-and-test-front-qa.yml | 2 +- .github/workflows/deploy-connectors.yml | 2 +- .github/workflows/deploy-core.yml | 2 +- .github/workflows/deploy-front-edge.yml | 2 +- .github/workflows/deploy-front.yml | 2 +- .github/workflows/deploy-oauth.yml | 2 +- .github/workflows/deploy-prodbox.yml | 2 +- .github/workflows/deploy-viz.yml | 2 +- k8s/cloud-build.sh | 8 ++++++++ k8s/cloudbuild.yaml | 2 +- 11 files changed, 18 insertions(+), 10 deletions(-) diff --git a/.github/workflows/deploy-alerting-temporal.yml b/.github/workflows/deploy-alerting-temporal.yml index ee916bf0f7b5..e44c0840b239 100644 --- a/.github/workflows/deploy-alerting-temporal.yml +++ b/.github/workflows/deploy-alerting-temporal.yml @@ -41,7 +41,7 @@ jobs: - name: Build the image on Cloud Build run: | chmod +x ./k8s/cloud-build.sh - ./k8s/cloud-build.sh --image-name=alerting-temporal --dockerfile-path=./Dockerfile --working-dir=./alerting/temporal/ + ./k8s/cloud-build.sh --image-name=alerting-temporal --dockerfile-path=./Dockerfile --working-dir=./alerting/temporal/ --dust-client-facing-url=https://dust.tt - name: Deploy the image on Kubernetes run: | diff --git a/.github/workflows/deploy-and-test-front-qa.yml b/.github/workflows/deploy-and-test-front-qa.yml index 9fa6b7bc78e8..0bdfb92c8db4 100644 --- a/.github/workflows/deploy-and-test-front-qa.yml +++ b/.github/workflows/deploy-and-test-front-qa.yml @@ -51,7 +51,7 @@ jobs: - name: Build the image on Cloud Build run: | chmod +x ./k8s/cloud-build.sh - ./k8s/cloud-build.sh --image-name=$IMAGE_NAME --dockerfile-path=./front/Dockerfile --working-dir=./ + ./k8s/cloud-build.sh --image-name=$IMAGE_NAME --dockerfile-path=./front/Dockerfile --working-dir=./ --dust-client-facing-url=https://front-qa.dust.tt - name: Deploy the image on Kubernetes run: | diff --git a/.github/workflows/deploy-connectors.yml b/.github/workflows/deploy-connectors.yml index 203eaffee1f4..54cd00ad610f 100644 --- a/.github/workflows/deploy-connectors.yml +++ b/.github/workflows/deploy-connectors.yml @@ -43,7 +43,7 @@ jobs: - name: Build the image on Cloud Build run: | chmod +x ./k8s/cloud-build.sh - ./k8s/cloud-build.sh --image-name=connectors --dockerfile-path=./connectors/Dockerfile --working-dir=./ + ./k8s/cloud-build.sh --image-name=connectors --dockerfile-path=./connectors/Dockerfile --working-dir=./ --dust-client-facing-url=https://dust.tt - name: Deploy the image on Kubernetes run: | diff --git a/.github/workflows/deploy-core.yml b/.github/workflows/deploy-core.yml index 27e881b711b8..ea9e071238cb 100644 --- a/.github/workflows/deploy-core.yml +++ b/.github/workflows/deploy-core.yml @@ -43,7 +43,7 @@ jobs: - name: Build the image on Cloud Build run: | chmod +x ./k8s/cloud-build.sh - ./k8s/cloud-build.sh --image-name=core --dockerfile-path=./Dockerfile --working-dir=./core/ + ./k8s/cloud-build.sh --image-name=core --dockerfile-path=./Dockerfile --working-dir=./core/ --dust-client-facing-url=https://dust.tt - name: Deploy the image on Kubernetes run: | diff --git a/.github/workflows/deploy-front-edge.yml b/.github/workflows/deploy-front-edge.yml index 11f38873ac35..9e020a4743c4 100644 --- a/.github/workflows/deploy-front-edge.yml +++ b/.github/workflows/deploy-front-edge.yml @@ -42,7 +42,7 @@ jobs: - name: Build the image on Cloud Build run: | chmod +x ./k8s/cloud-build.sh - ./k8s/cloud-build.sh --image-name=$IMAGE_NAME --dockerfile-path=./front/Dockerfile --working-dir=./ + ./k8s/cloud-build.sh --image-name=$IMAGE_NAME --dockerfile-path=./front/Dockerfile --working-dir=./ --dust-client-facing-url=https://front-edge.dust.tt - name: Deploy the image on Kubernetes run: | diff --git a/.github/workflows/deploy-front.yml b/.github/workflows/deploy-front.yml index 7bd3ded99813..682f97849110 100644 --- a/.github/workflows/deploy-front.yml +++ b/.github/workflows/deploy-front.yml @@ -43,7 +43,7 @@ jobs: - name: Build the image on Cloud Build run: | chmod +x ./k8s/cloud-build.sh - ./k8s/cloud-build.sh --image-name=front --dockerfile-path=./front/Dockerfile --working-dir=./ + ./k8s/cloud-build.sh --image-name=front --dockerfile-path=./front/Dockerfile --working-dir=./ --dust-client-facing-url=https://dust.tt - name: Deploy the image on Kubernetes run: | diff --git a/.github/workflows/deploy-oauth.yml b/.github/workflows/deploy-oauth.yml index ca05e7714296..26c505d4e6a9 100644 --- a/.github/workflows/deploy-oauth.yml +++ b/.github/workflows/deploy-oauth.yml @@ -43,7 +43,7 @@ jobs: - name: Build the image on Cloud Build run: | chmod +x ./k8s/cloud-build.sh - ./k8s/cloud-build.sh --image-name=oauth --dockerfile-path=./oauth.Dockerfile --working-dir=./core/ + ./k8s/cloud-build.sh --image-name=oauth --dockerfile-path=./oauth.Dockerfile --working-dir=./core/ --dust-client-facing-url=https://dust.tt - name: Deploy the image on Kubernetes run: | diff --git a/.github/workflows/deploy-prodbox.yml b/.github/workflows/deploy-prodbox.yml index 8ec103784987..0a09a8e1d6dd 100644 --- a/.github/workflows/deploy-prodbox.yml +++ b/.github/workflows/deploy-prodbox.yml @@ -44,7 +44,7 @@ jobs: - name: Build the image on Cloud Build run: | chmod +x ./k8s/cloud-build.sh - ./k8s/cloud-build.sh --image-name=prodbox --dockerfile-path=./prodbox.Dockerfile --working-dir=./ --gcloud-ignore-file=.gcloudignore-prodbox + ./k8s/cloud-build.sh --image-name=prodbox --dockerfile-path=./prodbox.Dockerfile --working-dir=./ --gcloud-ignore-file=.gcloudignore-prodbox --dust-client-facing-url=https://dust.tt - name: Deploy the image on Kubernetes run: | diff --git a/.github/workflows/deploy-viz.yml b/.github/workflows/deploy-viz.yml index 091d9b7d557f..ae198b863d08 100644 --- a/.github/workflows/deploy-viz.yml +++ b/.github/workflows/deploy-viz.yml @@ -43,7 +43,7 @@ jobs: - name: Build the image on Cloud Build run: | chmod +x ./k8s/cloud-build.sh - ./k8s/cloud-build.sh --image-name=viz --dockerfile-path=./viz/Dockerfile --working-dir=./ + ./k8s/cloud-build.sh --image-name=viz --dockerfile-path=./viz/Dockerfile --working-dir=./ --dust-client-facing-url=https://dust.tt - name: Deploy the image on Kubernetes run: | diff --git a/k8s/cloud-build.sh b/k8s/cloud-build.sh index a992f81f835b..bc6df82238ee 100755 --- a/k8s/cloud-build.sh +++ b/k8s/cloud-build.sh @@ -9,6 +9,7 @@ WORKING_DIR="" GCLOUD_IGNORE_FILE="" IMAGE_NAME="" DOCKERFILE_PATH="" +DUST_CLIENT_FACING_URL="" # parse command-line arguments while [[ $# -gt 0 ]]; do @@ -29,6 +30,10 @@ while [[ $# -gt 0 ]]; do DOCKERFILE_PATH="${1#*=}" shift ;; + --dust-client-facing-url=*) + DUST_CLIENT_FACING_URL="${1#*=}" + shift + ;; *) echo "unknown argument: $1" exit 1 @@ -54,6 +59,9 @@ echo "current working directory is $(pwd)" # prepare substitutions SUBSTITUTIONS="SHORT_SHA=$(git rev-parse --short HEAD),_IMAGE_NAME=$IMAGE_NAME,_DOCKERFILE_PATH=$DOCKERFILE_PATH" +if [ -n "$DUST_CLIENT_FACING_URL" ]; then + SUBSTITUTIONS="$SUBSTITUTIONS,_DUST_CLIENT_FACING_URL=$DUST_CLIENT_FACING_URL" +fi # start the build and get its id echo "starting build..." diff --git a/k8s/cloudbuild.yaml b/k8s/cloudbuild.yaml index 8f49030ae6b0..90febed3ee8e 100644 --- a/k8s/cloudbuild.yaml +++ b/k8s/cloudbuild.yaml @@ -18,7 +18,7 @@ steps: - --build-arg - NEXT_PUBLIC_GA_TRACKING_ID=G-K9HQ2LE04G - --build-arg - - NEXT_PUBLIC_DUST_CLIENT_FACING_URL=https://dust.tt + - NEXT_PUBLIC_DUST_CLIENT_FACING_URL=${_DUST_CLIENT_FACING_URL} - . secretEnv: - "DEPOT_TOKEN"