Skip to content

Commit

Permalink
[github/k8s] - feature: add dynamic client-facing URL to Docker builds (
Browse files Browse the repository at this point in the history
#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 <[email protected]>
  • Loading branch information
JulesBelveze and Jules authored Sep 21, 2024
1 parent 62cfc0c commit 3faa41d
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy-alerting-temporal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-and-test-front-qa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-connectors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-front-edge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-front.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-oauth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-prodbox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-viz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
8 changes: 8 additions & 0 deletions k8s/cloud-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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..."
Expand Down
2 changes: 1 addition & 1 deletion k8s/cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 3faa41d

Please sign in to comment.