Skip to content

Commit

Permalink
Enhance Slack notification footer (#1384)
Browse files Browse the repository at this point in the history
  • Loading branch information
mszostok authored Feb 19, 2024
1 parent a5f9e07 commit ea1de35
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 7 deletions.
22 changes: 18 additions & 4 deletions .github/actions/cloud-slack-e2e/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,19 @@ runs:
run: "wget -q -O - https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | TAG=${K3D_VERSION} bash"

- name: Create k3d cluster
id: k3d
shell: bash
run: "k3d cluster create cloud-slack-e2e-cluster --wait --timeout=5m"

- name: Setup Go modules
id: modules
uses: ./.github/actions/setup-go-mod-private
with:
access_token: ${{ inputs.access_token }}
username: ${{ env.GIT_USER }}

- name: Run e2e tests
id: tests
shell: bash
env:
SLACK_WORKSPACE_NAME: ${{ inputs.slack_workspace_name }}
Expand All @@ -96,7 +99,6 @@ runs:
DEBUG_MODE: "true"
run: |
KUBECONFIG=$(k3d kubeconfig write cloud-slack-e2e-cluster) make test-cloud-slack-dev-e2e
- name: Upload artifacts
uses: actions/upload-artifact@v3
if: ${{ always() }}
Expand All @@ -109,15 +111,27 @@ runs:
if: ${{ failure() }}
uses: ./.github/actions/dump-cluster

- name: Detect failed jobs
if: ${{ failure() }}
id: footer
shell: bash
run: |
FOOTER=''
if [[ ${{ steps.k3d.outcome }} == failure ]]; then FOOTER='Failed to setup k3d cluster'; fi
if [[ ${{ steps.modules.outcome }} == failure ]]; then FOOTER='Failed to setup Go modules'; fi
if [[ ${{ steps.tests.outcome }} == failure ]]; then FOOTER='Failed to run e2e tests'; fi
echo "footer=${FOOTER}" >> $GITHUB_OUTPUT
- name: Slack Notification
uses: rtCamp/action-slack-notify@v2
if: ${{ failure() }}
env:
SLACK_CHANNEL: 'botkube-cloud-ci-alerts'
SLACK_USERNAME: Botkube Cloud CI
SLACK_COLOR: 'red'
SLACK_TITLE: 'Message'
SLACK_CHANNEL: 'botkube-cloud-ci-alerts'
SLACK_MESSAGE: "Cloud Slack ${{ inputs.e2e_type }} E2E tests failed :scream:"
SLACK_MESSAGE: "Cloud Slack ${{ inputs.e2e_type }} E2E tests failed :scream:"
SLACK_ICON_EMOJI: ':this-is-fine-fire:'
SLACK_FOOTER: "Fingers crossed it's just an outdated/flaky test..."
SLACK_FOOTER: ${{ steps.footer.outputs.footer }}
SLACK_WEBHOOK: ${{ inputs.slack_alerts_webhook }}
17 changes: 15 additions & 2 deletions .github/workflows/branch-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ jobs:
make build-plugins
- name: CLI Cache
if: matrix.integration != 'discord'
uses: actions/cache@v3
with:
path: |
Expand All @@ -159,6 +160,7 @@ jobs:
key: ${{ runner.os }}-botkube-cli

- name: Build CLI
if: matrix.integration != 'discord'
run: make build-single-arch-cli

- name: Add Botkube CLI to env
Expand Down Expand Up @@ -192,6 +194,19 @@ jobs:
KUBECONFIG=$(k3d kubeconfig write ${{ matrix.integration }}-test-cluster) \
make test-integration-${{ matrix.integration }}
- name: Slack Notification
uses: rtCamp/action-slack-notify@v2
if: ${{ failure() }}
env:
SLACK_USERNAME: Botkube Cloud CI
SLACK_COLOR: 'red'
SLACK_TITLE: 'Message'
SLACK_CHANNEL: 'botkube-cloud-ci-alerts'
SLACK_MESSAGE: 'Integration ${{ matrix.integration }} test failed :scream:'
SLACK_ICON_EMOJI: ':this-is-fine-fire:'
SLACK_WEBHOOK: ${{ secrets.SLACK_CI_ALERTS_WEBHOOK }}
SLACK_FOOTER: "Fingers crossed it's just an outdated/flaky test..."

cli-migration-e2e:
name: CLI Migration E2E tests
runs-on: ubuntu-latest
Expand All @@ -202,8 +217,6 @@ jobs:
concurrency:
group: cli-migration-e2e
cancel-in-progress: false
strategy:
fail-fast: false
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/prod-e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ jobs:
botkube_cloud_free_organization_id: ${{ secrets.E2E_PROD_BOTKUBE_CLOUD_FREE_ORGANIZATION_ID }}
botkube_cloud_plugin_repo_url: "https://storage.googleapis.com/botkube-plugins-latest/plugins-index.yaml"

slack_alerts_webhook: ${{ secrets.SLACK_PROD_ALERTS_WEBHOOK }}
slack_alerts_webhook: ${{ secrets.SLACK_CI_ALERTS_WEBHOOK }}

e2e_type: "PROD"

0 comments on commit ea1de35

Please sign in to comment.