Skip to content

Commit

Permalink
Merge pull request #915 from ArangoGutierrez/slack_bot
Browse files Browse the repository at this point in the history
[no-relnote] Add Slack notification for e2e test failures
  • Loading branch information
elezar authored Aug 23, 2024
2 parents 3052830 + 4a73a4f commit 1d454fd
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 4 deletions.
22 changes: 20 additions & 2 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,22 @@ jobs:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }} && ${{ github.event.workflow_run.event == 'push' }}
steps:
- uses: actions/checkout@v4
name: Check out code
- name: Check out code
uses: actions/checkout@v4

- name: Calculate build vars
id: vars
run: |
echo "COMMIT_SHORT_SHA=${GITHUB_SHA:0:8}" >> $GITHUB_ENV
- name: Set up Holodeck
uses: NVIDIA/[email protected]
with:
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_ssh_key: ${{ secrets.AWS_SSH_KEY }}
holodeck_config: "tests/e2e/infra/aws.yaml"

- name: Run e2e tests
env:
KUBECONFIG: ${{ github.workspace }}/kubeconfig
Expand All @@ -49,10 +52,25 @@ jobs:
LOG_ARTIFACTS: ${{ github.workspace }}/e2e_logs
run: |
make test-e2e
- name: Archive test logs
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: e2e-test-logs
path: ./e2e_logs/
retention-days: 15

- name: Send Slack alert notification
id: slack
if: ${{ failure() }}
uses: slackapi/[email protected]
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
SUMMARY_URL: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
with:
channel-id: ${{ secrets.SLACK_CHANNEL_ID }}
slack-message: |
:red_target: On repository ${{ github.repository }} the Workflow *${{ github.workflow }}* has failed.
Details: ${{ env.SUMMARY_URL }}
24 changes: 22 additions & 2 deletions .github/workflows/staging_e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,29 +28,34 @@ jobs:
runs-on: pdx01-arc-runners
if: ${{ github.event.workflow_run.conclusion == 'success' }} && ${{ github.event.workflow_run.event == 'push' }}
steps:
- uses: actions/checkout@v4
name: Check out code
- name: Check out code
uses: actions/checkout@v4

- name: Calculate build vars
id: vars
run: |
echo "COMMIT_SHORT_SHA=${GITHUB_SHA:0:8}" >> $GITHUB_ENV
GOLANG_VERSION=$(./hack/golang-version.sh)
echo "GOLANG_VERSION=${GOLANG_VERSION##GOLANG_VERSION := }" >> $GITHUB_ENV
- name: Set up Holodeck
uses: NVIDIA/[email protected]
with:
vsphere_username: ${{ secrets.VSPHERE_USERNAME }}
vsphere_password: ${{ secrets.VSPHERE_PASSWORD }}
vsphere_ssh_key: ${{ secrets.VSPHERE_SSH_KEY }}
holodeck_config: "tests/e2e/infra/vsphere.yaml"

- name: Intall dependencies
run: |
sudo apt-get update
sudo apt-get install -y make
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GOLANG_VERSION }}

- name: Run e2e tests
env:
KUBECONFIG: ${{ github.workspace }}/kubeconfig
Expand All @@ -59,10 +64,25 @@ jobs:
LOG_ARTIFACTS: ${{ github.workspace }}/e2e_logs
run: |
make test-e2e
- name: Archive test logs
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: e2e-test-logs
path: ./e2e_logs/
retention-days: 15

- name: Send Slack alert notification
id: slack
if: ${{ failure() }}
uses: slackapi/[email protected]
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
SUMMARY_URL: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
with:
channel-id: ${{ secrets.SLACK_CHANNEL_ID }}
slack-message: |
:red_target: On repository ${{ github.repository }} the Workflow *${{ github.workflow }}* has failed.
Details: ${{ env.SUMMARY_URL }}

0 comments on commit 1d454fd

Please sign in to comment.