-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[.github] - refacto: workflow deploy front qa (#8720)
* [.github/workflows] - refactor: streamline QA deployment and testing workflow - Removed the previous QA deployment and testing workflow - Introduced a new workflow that triggers a component deploy process in a different repository using a dispatch event * [.github] - feature: add automated playwright tests workflow for dispatched events - Introduce a GitHub Actions workflow that triggers Playwright tests via a webhook upon repository dispatch - Implement a step to wait for the triggered tests to complete and exit based on their conclusion - Add a step to send a Slack notification if the Playwright tests fail * Update .github/workflows/deploy-front-qa.yml Co-authored-by: Flavien David <[email protected]> --------- Co-authored-by: Flavien David <[email protected]>
- Loading branch information
1 parent
477cc17
commit 87d9e69
Showing
2 changed files
with
84 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
name: Deploy Front QA | ||
|
||
on: | ||
pull_request: | ||
types: [closed] | ||
branches: | ||
- main | ||
paths-ignore: | ||
- "**.md" | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: deploy_front_qa | ||
cancel-in-progress: false | ||
|
||
env: | ||
GCLOUD_PROJECT_ID: ${{ secrets.GCLOUD_PROJECT_ID }} | ||
|
||
jobs: | ||
build-and-deploy: | ||
runs-on: ubuntu-latest | ||
# We skip running the build and deploy if the PR contains a migration represented by the 'migration-ack' label. | ||
if: ${{ !contains(github.event.pull_request.labels.*.name, 'migration-ack') }} | ||
|
||
steps: | ||
- name: Checkout code | ||
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: "Set up Cloud SDK" | ||
uses: "google-github-actions/setup-gcloud@v1" | ||
|
||
- name: Build the image on Cloud Build | ||
run: | | ||
chmod +x ./k8s/cloud-build.sh | ||
./k8s/cloud-build.sh \ | ||
--image-name=front-qa \ | ||
--dockerfile-path=./front/Dockerfile \ | ||
--working-dir=./ \ | ||
--dust-client-facing-url=https://front-qa.dust.tt | ||
- 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: 'us-central1', | ||
component: 'front-qa', | ||
image_tag: '${{ steps.short_sha.outputs.short_sha }}', | ||
run_playwright: true, | ||
playwright_sha: '${{ github.sha }}', | ||
repository_name: '${{ github.event.repository.name }}' | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters