Skip to content

Commit

Permalink
VER-94860 auto process result (#901)
Browse files Browse the repository at this point in the history
This PR add steps in E2E test to:

Check if the job is success, if success, we will call a sync script
which will ask Vcluster to merge certain branch to master.
We will notify E2E test result to a teams channel for checking the job
status.

The previous PR with conversation can be found under
#859
  • Loading branch information
HaoYang0000 committed Aug 21, 2024
1 parent 5db3ec0 commit 6ead47f
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 1 deletion.
52 changes: 51 additions & 1 deletion .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: e2e tests

on:
push:
branches: [main, vnext]
branches: [main, k8s-sync-*]
pull_request:
workflow_dispatch:
inputs:
Expand Down Expand Up @@ -561,3 +561,53 @@ jobs:
vertica-image: ${{ needs.build.outputs.full-vertica-image }}
vertica-deployment-method: vclusterops
communal-storage-type: s3

sync-vcluster:
name: Sync-vcluster-repo
needs: [
e2e-leg-1-admintools,
e2e-leg-1-admintools-previous-release,
e2e-leg-1-vcluster,
e2e-leg-2-admintools,
e2e-leg-2-admintools-previous-release,
e2e-leg-2-vcluster,
e2e-leg-3-admintools,
e2e-leg-3-vclusterops-previous-release,
e2e-leg-3-vcluster,
e2e-leg-4-admintools,
e2e-leg-4-vcluster,
e2e-leg-5-admintools,
e2e-leg-5-vcluster,
e2e-leg-6-vcluster,
e2e-leg-7-vcluster,
e2e-leg-8-vcluster,
e2e-leg-9-vcluster,
e2e-server-upgrade-admintools,
e2e-server-upgrade-vcluster,
e2e-operator-upgrade,
e2e-udx-admintools,
e2e-udx-vcluster
]
runs-on: ubuntu-latest
if: ${{ always() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') && contains('k8s-sync', github.ref_name) && (github.event_name == 'push')}}
steps:
- name: Check out
uses: actions/checkout@v4
- name: Run Sync script
run: |
echo "Running sync script"
scripts/vcluster-sync.sh ${{ github.ref }} main ${{ secrets.VCLUSTER_CICD }}
notification:
name: team-notification
needs: [sync-vcluster]
runs-on: ubuntu-latest
if: ${{ always() }} && contains('k8s-sync', github.ref)
steps:
- name: notification
uses: jdcargile/ms-teams-notification@v1.4
with:
github-token: ${{ github.token }}
ms-teams-webhook-uri: ${{ secrets.MS_TEAMS_WEBHOOK_URI }}
notification-summary: ${{ github.job }} job in worflow ${{ github.workflow }} of ${{ github.repository }} has ${{ job.status }} on branch ${{ github.ref }}
verbose-logging: true
15 changes: 15 additions & 0 deletions scripts/vcluster-sync.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

SOURCE_BRANCH=$1
TARGET_BRANCH=$2
GITHUB_CRED=$3
GITHUB_OWNER=vertica
GITHUB_REPO=vcluster

curl -L -v \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_CRED" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/$GITHUB_OWNER/$GITHUB_REPO/dispatches \
-d '{"event_type": "curl_request_merge", "client_payload":{"source_branch":"'"$SOURCE_BRANCH"'","target_branch":"'"$TARGET_BRANCH"'"}}'

0 comments on commit 6ead47f

Please sign in to comment.