diff --git a/.github/workflows/deploy-alerting-temporal.yml b/.github/workflows/deploy-alerting-temporal.yml index 9b0a17a86f56..366710547186 100644 --- a/.github/workflows/deploy-alerting-temporal.yml +++ b/.github/workflows/deploy-alerting-temporal.yml @@ -44,7 +44,8 @@ jobs: --image-name=alerting-temporal \ --dockerfile-path=./Dockerfile \ --working-dir=./alerting/temporal/ \ - --dust-client-facing-url=https://dust.tt + --dust-client-facing-url=https://dust.tt \ + --region=us-central1 - name: Generate a token id: generate-token diff --git a/.github/workflows/deploy-connectors.yml b/.github/workflows/deploy-connectors.yml index 6f6ae9fd087d..63100fa149f8 100644 --- a/.github/workflows/deploy-connectors.yml +++ b/.github/workflows/deploy-connectors.yml @@ -67,7 +67,8 @@ jobs: --image-name=connectors \ --dockerfile-path=./connectors/Dockerfile \ --working-dir=./ \ - --dust-client-facing-url=https://dust.tt + --dust-client-facing-url=https://dust.tt \ + --region=us-central1 - name: Generate a token id: generate-token diff --git a/.github/workflows/deploy-core.yml b/.github/workflows/deploy-core.yml index aeb530e5aa61..52d88b80459f 100644 --- a/.github/workflows/deploy-core.yml +++ b/.github/workflows/deploy-core.yml @@ -67,7 +67,8 @@ jobs: --image-name=core \ --dockerfile-path=./Dockerfile \ --working-dir=./core/ \ - --dust-client-facing-url=https://dust.tt + --dust-client-facing-url=https://dust.tt \ + --region=us-central1 - name: Generate a token id: generate-token diff --git a/.github/workflows/deploy-dante.yml b/.github/workflows/deploy-dante.yml index ea927ca9d909..5769f24350a2 100644 --- a/.github/workflows/deploy-dante.yml +++ b/.github/workflows/deploy-dante.yml @@ -54,7 +54,8 @@ jobs: --dockerfile-path=./dante.Dockerfile \ --working-dir=./ \ --gcloud-ignore-file=../.gcloudignore-dante \ - --dust-client-facing-url=https://dust.tt + --dust-client-facing-url=https://dust.tt \ + --region=us-central1 cd .. - name: Generate a token diff --git a/.github/workflows/deploy-front-edge.yml b/.github/workflows/deploy-front-edge.yml index be67c31c2320..2bb2d5b62053 100644 --- a/.github/workflows/deploy-front-edge.yml +++ b/.github/workflows/deploy-front-edge.yml @@ -3,6 +3,15 @@ name: Deploy Front Edge on: workflow_dispatch: inputs: + regions: + description: "Regions to deploy to" + required: true + default: "us-central1" + type: choice + options: + - "us-central1" + - "europe-west1" + - "us-central1,europe-west1" check_deployment_blocked: description: "Check #deployment locks or force deploy" required: true @@ -21,13 +30,12 @@ env: IMAGE_NAME: front-edge jobs: - build-and-deploy: + notify-start: runs-on: ubuntu-latest - + outputs: + thread_ts: ${{ steps.build_message.outputs.thread_ts }} steps: - - name: Checkout code - uses: actions/checkout@v3 - + - uses: actions/checkout@v3 - name: Get short sha id: short_sha run: echo "short_sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT @@ -51,20 +59,42 @@ jobs: channel: ${{ secrets.SLACK_CHANNEL_ID }} slack_token: ${{ secrets.SLACK_BOT_TOKEN }} + build: + needs: notify-start + runs-on: ubuntu-latest + strategy: + matrix: + region: ${{ fromJson(format('[{0}]', join(split(github.event.inputs.regions, ','), ','))) }} + fail-fast: true + + steps: + - uses: actions/checkout@v3 + - name: Get short sha + id: short_sha + run: echo "short_sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT - name: "Authenticate with Google Cloud" uses: "google-github-actions/auth@v1" with: credentials_json: "${{ secrets.GCLOUD_SA_KEY }}" - - name: Build the image on Cloud Build + - name: Build image for ${{ matrix.region }} run: | chmod +x ./k8s/cloud-build.sh ./k8s/cloud-build.sh \ --image-name=$IMAGE_NAME \ --dockerfile-path=./front/Dockerfile \ --working-dir=./ \ - --dust-client-facing-url=https://front-edge.dust.tt + --dust-client-facing-url=https://front-edge.dust.tt \ + --region=${{ matrix.region }} + deploy: + needs: [notify-start, build] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Get short sha + id: short_sha + run: echo "short_sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT - name: Generate a token id: generate-token uses: actions/create-github-app-token@v1 @@ -85,10 +115,10 @@ jobs: repo: 'dust-infra', event_type: 'trigger-component-deploy', client_payload: { - regions: 'us-central1', + regions: '${{ github.event.inputs.regions }}', component: 'front-edge', image_tag: '${{ steps.short_sha.outputs.short_sha }}', - slack_thread_ts: "${{ steps.build_message.outputs.thread_ts }}", + slack_thread_ts: "${{ needs.notify-start.outputs.thread_ts }}", slack_channel: '${{ secrets.SLACK_CHANNEL_ID }}' } }); @@ -103,4 +133,4 @@ jobs: image_tag: ${{ steps.short_sha.outputs.short_sha }} channel: ${{ secrets.SLACK_CHANNEL_ID }} slack_token: ${{ secrets.SLACK_BOT_TOKEN }} - thread_ts: "${{ steps.build_message.outputs.thread_ts }}" + thread_ts: "${{ needs.notify-start.outputs.thread_ts }}" diff --git a/.github/workflows/deploy-front-qa.yml b/.github/workflows/deploy-front-qa.yml index 9fcecb8d6d4f..d685f6444801 100644 --- a/.github/workflows/deploy-front-qa.yml +++ b/.github/workflows/deploy-front-qa.yml @@ -45,7 +45,8 @@ jobs: --image-name=front-qa \ --dockerfile-path=./front/Dockerfile \ --working-dir=./ \ - --dust-client-facing-url=https://front-qa.dust.tt + --dust-client-facing-url=https://front-qa.dust.tt \ + --region=us-central1 - name: Generate a token id: generate-token diff --git a/.github/workflows/deploy-front.yml b/.github/workflows/deploy-front.yml index 4346817615ab..79e77040efa9 100644 --- a/.github/workflows/deploy-front.yml +++ b/.github/workflows/deploy-front.yml @@ -64,7 +64,8 @@ jobs: --image-name=front \ --dockerfile-path=./front/Dockerfile \ --working-dir=./ \ - --dust-client-facing-url=https://dust.tt + --dust-client-facing-url=https://dust.tt \ + --region=us-central1 - name: Generate a token id: generate-token diff --git a/.github/workflows/deploy-nginx.yml b/.github/workflows/deploy-nginx.yml index 27d3395c4af3..edbbed1d1e18 100644 --- a/.github/workflows/deploy-nginx.yml +++ b/.github/workflows/deploy-nginx.yml @@ -51,7 +51,8 @@ jobs: --dockerfile-path=./nginx.Dockerfile \ --working-dir=./ \ --gcloud-ignore-file=../.gcloudignore-nginx \ - --dust-client-facing-url=https://dust.tt + --dust-client-facing-url=https://dust.tt \ + --region=us-central1 cd .. - name: Generate a token diff --git a/.github/workflows/deploy-oauth.yml b/.github/workflows/deploy-oauth.yml index 5090c887e0fe..e077f67f8546 100644 --- a/.github/workflows/deploy-oauth.yml +++ b/.github/workflows/deploy-oauth.yml @@ -64,7 +64,8 @@ jobs: --image-name=oauth \ --dockerfile-path=./oauth.Dockerfile \ --working-dir=./core/ \ - --dust-client-facing-url=https://dust.tt + --dust-client-facing-url=https://dust.tt \ + --region=us-central1 - name: Generate a token id: generate-token diff --git a/.github/workflows/deploy-prodbox.yml b/.github/workflows/deploy-prodbox.yml index cd9c08ee4679..bf687854570e 100644 --- a/.github/workflows/deploy-prodbox.yml +++ b/.github/workflows/deploy-prodbox.yml @@ -69,7 +69,8 @@ jobs: --dockerfile-path=./prodbox.Dockerfile \ --working-dir=./ \ --gcloud-ignore-file=.gcloudignore-prodbox \ - --dust-client-facing-url=https://dust.tt + --dust-client-facing-url=https://dust.tt \ + --region=us-central1 - name: Generate a token id: generate-token @@ -109,4 +110,4 @@ jobs: image_tag: ${{ steps.short_sha.outputs.short_sha }} channel: ${{ secrets.SLACK_CHANNEL_ID }} slack_token: ${{ secrets.SLACK_BOT_TOKEN }} - thread_ts: "${{ steps.build_message.outputs.thread_ts }}" + thread_ts: "${{ steps.build_message.outputs.thread_ts }}" \ No newline at end of file diff --git a/.github/workflows/deploy-viz.yml b/.github/workflows/deploy-viz.yml index 40c1e496bd25..3879da60c651 100644 --- a/.github/workflows/deploy-viz.yml +++ b/.github/workflows/deploy-viz.yml @@ -67,7 +67,8 @@ jobs: --image-name=viz \ --dockerfile-path=./viz/Dockerfile \ --working-dir=./ \ - --dust-client-facing-url=https://dust.tt + --dust-client-facing-url=https://dust.tt \ + --region=us-central1 - name: Generate a token id: generate-token diff --git a/k8s/cloud-build.sh b/k8s/cloud-build.sh index 04044fbf6b32..5187912f33ea 100755 --- a/k8s/cloud-build.sh +++ b/k8s/cloud-build.sh @@ -10,6 +10,7 @@ GCLOUD_IGNORE_FILE="" IMAGE_NAME="" DOCKERFILE_PATH="" DUST_CLIENT_FACING_URL="" +REGION="" # parse command-line arguments while [[ $# -gt 0 ]]; do @@ -34,6 +35,10 @@ while [[ $# -gt 0 ]]; do DUST_CLIENT_FACING_URL="${1#*=}" shift ;; + --region=*) + REGION="${1#*=}" + shift + ;; *) echo "unknown argument: $1" exit 1 @@ -42,8 +47,8 @@ while [[ $# -gt 0 ]]; do done # check required arguments -if [ -z "$WORKING_DIR" ] || [ -z "$IMAGE_NAME" ] || [ -z "$DOCKERFILE_PATH" ]; then - echo "error: --working-dir, --image-name, and --dockerfile-path are required" +if [ -z "$WORKING_DIR" ] || [ -z "$IMAGE_NAME" ] || [ -z "$DOCKERFILE_PATH" ] || [ -z "$REGION" ]; then + echo "error: --working-dir, --image-name, --region and --dockerfile-path are required" exit 1 fi @@ -54,13 +59,13 @@ cd "$WORKING_DIR" echo "current working directory is $(pwd)" # prepare substitutions -SUBSTITUTIONS="SHORT_SHA=$(git rev-parse --short HEAD),_IMAGE_NAME=$IMAGE_NAME,_DOCKERFILE_PATH=$DOCKERFILE_PATH" +SUBSTITUTIONS="SHORT_SHA=$(git rev-parse --short HEAD),_IMAGE_NAME=$IMAGE_NAME,_DOCKERFILE_PATH=$DOCKERFILE_PATH,_REGION=$REGION" if [ -n "$DUST_CLIENT_FACING_URL" ]; then SUBSTITUTIONS="$SUBSTITUTIONS,_DUST_CLIENT_FACING_URL=$DUST_CLIENT_FACING_URL" fi # prepare the gcloud command -GCLOUD_CMD=(gcloud builds submit --quiet --config "${SCRIPT_DIR}/cloudbuild.yaml") +GCLOUD_CMD=(gcloud builds submit --quiet --config "${SCRIPT_DIR}/cloudbuild.yaml" --region="$REGION") # add ignore file argument if specified if [ -n "$GCLOUD_IGNORE_FILE" ]; then diff --git a/k8s/cloudbuild.yaml b/k8s/cloudbuild.yaml index cd8b25778d58..69b497f3eb17 100644 --- a/k8s/cloudbuild.yaml +++ b/k8s/cloudbuild.yaml @@ -5,8 +5,8 @@ steps: depot build \ --project 3vz0lnf16v \ --provenance=false \ - -t us-central1-docker.pkg.dev/${PROJECT_ID}/dust-images/${_IMAGE_NAME}:${SHORT_SHA} \ - -t us-central1-docker.pkg.dev/${PROJECT_ID}/dust-images/${_IMAGE_NAME}:latest \ + -t ${_REGION}-docker.pkg.dev/${PROJECT_ID}/dust-images/${_IMAGE_NAME}:${SHORT_SHA} \ + -t ${_REGION}-docker.pkg.dev/${PROJECT_ID}/dust-images/${_IMAGE_NAME}:latest \ -f ${_DOCKERFILE_PATH} \ --build-arg COMMIT_HASH=${SHORT_SHA} \ --build-arg NEXT_PUBLIC_VIZ_URL=https://viz.dust.tt \