Skip to content

Deploy Front Edge

Deploy Front Edge #976

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
default: "check"
type: choice
options:
- "check"
- "force (dangerous)"
concurrency:
group: deploy_front_edge
cancel-in-progress: false
env:
GCLOUD_PROJECT_ID: ${{ secrets.GCLOUD_PROJECT_ID }}
IMAGE_NAME: front-edge
jobs:
notify-start:
runs-on: ubuntu-latest
outputs:
thread_ts: ${{ steps.build_message.outputs.thread_ts }}
steps:
- uses: actions/checkout@v3
- name: Get short sha
id: short_sha
run: echo "short_sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Notify Build And Deploy Start
id: build_message
uses: ./.github/actions/slack-notify
with:
step: "start"
component: "front-edge"
image_tag: ${{ steps.short_sha.outputs.short_sha }}
channel: ${{ secrets.SLACK_CHANNEL_ID }}
slack_token: ${{ secrets.SLACK_BOT_TOKEN }}
- name: Slack Check Deployment Blocked
if: ${{ github.event.inputs.check_deployment_blocked != 'force (dangerous)' }}
id: check_deployment_blocked
uses: ./.github/actions/slack-check-deployment-blocked
with:
component: "front-edge"
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, ','), ','))) }}

Check failure on line 67 in .github/workflows/deploy-front-edge.yml

View workflow run for this annotation

GitHub Actions / Deploy Front Edge

Invalid workflow file

The workflow is not valid. .github/workflows/deploy-front-edge.yml (Line: 67, Col: 17): Unrecognized function: 'split'. Located at position 31 within expression: fromJson(format('[{0}]', join(split(github.event.inputs.regions, ','), ','))) .github/workflows/deploy-front-edge.yml (Line: 67, Col: 17): Unexpected value '${{ 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 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 \
--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
with:
app-id: ${{ secrets.INFRA_DISPATCH_APP_ID }}
private-key: ${{ secrets.INFRA_DISPATCH_APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
repositories: |
dust-infra
- name: Trigger dust-infra workflow
uses: actions/github-script@v6
with:
github-token: ${{ steps.generate-token.outputs.token }}
script: |
await github.rest.repos.createDispatchEvent({
owner: '${{ github.repository_owner }}',
repo: 'dust-infra',
event_type: 'trigger-component-deploy',
client_payload: {
regions: '${{ github.event.inputs.regions }}',
component: 'front-edge',
image_tag: '${{ steps.short_sha.outputs.short_sha }}',
slack_thread_ts: "${{ needs.notify-start.outputs.thread_ts }}",
slack_channel: '${{ secrets.SLACK_CHANNEL_ID }}'
}
});
- name: Notify Failure
if: failure()
uses: ./.github/actions/slack-notify
with:
step: "failure"
blocked: ${{ steps.check_deployment_blocked.outputs.blocked }}
component: "front-edge"
image_tag: ${{ steps.short_sha.outputs.short_sha }}
channel: ${{ secrets.SLACK_CHANNEL_ID }}
slack_token: ${{ secrets.SLACK_BOT_TOKEN }}
thread_ts: "${{ needs.notify-start.outputs.thread_ts }}"