Skip to content

Commit

Permalink
Add link to exact run
Browse files Browse the repository at this point in the history
  • Loading branch information
mszostok committed Jul 1, 2024
1 parent 6a95f5e commit f3c9a6f
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 12 deletions.
29 changes: 19 additions & 10 deletions .github/actions/cloud-slack-e2e/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ inputs:
description: 'Slack Alerts Webhook'
required: true

slack_token:
description: 'Slack Alerts Webhook'
required: true

e2e_type:
description: "Type of e2e test"
required: true
Expand Down Expand Up @@ -90,13 +94,13 @@ runs:
SLACK_BOT_DISPLAY_NAME: ${{ inputs.slack_bot_display_name }}
SLACK_TESTER_BOT_NAME: ${{ inputs.slack_tester_bot_name }}
SLACK_TESTER_MESSAGE_WAIT_TIMEOUT: 180s

BOTKUBE_CLOUD_UI_BASE_URL: ${{ inputs.botkube_cloud_ui_base_url }}
BOTKUBE_CLOUD_API_BASE_URL: ${{ inputs.botkube_cloud_api_base_url }}
BOTKUBE_CLOUD_EMAIL: ${{ inputs.botkube_cloud_email }}
BOTKUBE_CLOUD_PASSWORD: ${{ inputs.botkube_cloud_password }}
BOTKUBE_CLOUD_TEAM_ORGANIZATION_ID: ${{ inputs.botkube_cloud_team_organization_id }}
SCREENSHOTS_DIR: ${{ runner.temp }}/screenshots
SCREENSHOTS_DIR: ./screenshots
DEBUG_MODE: "true"
run: |
KUBECONFIG=$(k3d kubeconfig write cloud-slack-e2e-cluster) make test-cloud-slack-dev-e2e
Expand All @@ -105,7 +109,7 @@ runs:
if: ${{ always() }}
with:
name: screenshots_dump_${{github.sha}}
path: ${{ runner.temp }}/screenshots
path: ./screenshots
retention-days: 5

- name: Dump cluster state
Expand All @@ -114,27 +118,32 @@ runs:
with:
name: cloud-slack-e2e

- name: Select the latest screenshot
if: ${{ failure() }}
shell: bash
run: |
FILE=$(find ./screenshots -type f -exec ls -t1 {} + | head -1)
echo "SCREENSHOT_LOCATION=${FILE}" >> $GITHUB_ENV
- 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
FOOTER='https://github.com/kubeshop/botkube/actions/runs/${{ github.run_id }}'
echo "footer=${FOOTER}" >> $GITHUB_OUTPUT
- name: Slack Notification
uses: rtCamp/action-slack-notify@v2
if: ${{ failure() }}
env:
SLACK_CHANNEL: 'botkube-cloud-ci-alerts'
# SLACK_CHANNEL: 'botkube-cloud-ci-alerts'
SLACK_CHANNEL: 'test-botkube-ci-alerts'
SLACK_USERNAME: Botkube Cloud CI
SLACK_COLOR: 'red'
SLACK_TITLE: 'Message'
SLACK_MESSAGE: "Cloud Slack ${{ inputs.e2e_type }} E2E tests failed :scream:"
SLACK_ICON_EMOJI: ':this-is-fine-fire:'
SLACK_FOOTER: ${{ steps.footer.outputs.footer }}
SLACK_WEBHOOK: ${{ inputs.slack_alerts_webhook }}
SLACK_TOKEN: ${{ inputs.slack_token }}
SLACK_FILE_UPLOAD: ${{ env.SCREENSHOT_LOCATION }}
2 changes: 1 addition & 1 deletion .github/workflows/branch-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,6 @@ jobs:
botkube_cloud_password: ${{ secrets.E2E_DEV_BOTKUBE_CLOUD_PASSWORD }}
botkube_cloud_team_organization_id: ${{ secrets.E2E_DEV_BOTKUBE_CLOUD_TEAM_ORGANIZATION_ID }}

slack_alerts_webhook: ${{ secrets.SLACK_CI_ALERTS_WEBHOOK }}
slack_token: ${{ secrets.SLACK_APP_TOKEN_FOR_CI_ALERTS }}

e2e_type: "DEV"
2 changes: 1 addition & 1 deletion .github/workflows/prod-e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ jobs:
botkube_cloud_password: ${{ secrets.E2E_DEV_BOTKUBE_CLOUD_PASSWORD }}
botkube_cloud_team_organization_id: ${{ secrets.E2E_PROD_BOTKUBE_CLOUD_TEAM_ORGANIZATION_ID }}

slack_alerts_webhook: ${{ secrets.SLACK_CI_ALERTS_WEBHOOK }}
slack_token: ${{ secrets.SLACK_APP_TOKEN_FOR_CI_ALERTS }}

e2e_type: "PROD"
48 changes: 48 additions & 0 deletions .github/workflows/test-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Test UI E2E tests on PR

on:
push:
branches:
- update-ci-slack-msg

env:
GIT_USER: botkube-dev
HELM_VERSION: v3.9.0
K3D_VERSION: v5.4.6
IMAGE_REGISTRY: "ghcr.io"
IMAGE_REPOSITORY: "kubeshop/botkube"
IMAGE_TAG: v9.99.9-dev # TODO: Use commit hash tag to make the predictable builds for each commit on branch

jobs:
cloud-slack-dev-e2e:
name: Botkube Cloud Slack Dev E2E
runs-on: ubuntu-latest
permissions:
contents: read
packages: read
concurrency:
group: cloud-slack-dev-e2e
cancel-in-progress: false
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Run e2e tests
uses: ./.github/actions/cloud-slack-e2e
with:
access_token: ${{ secrets.E2E_TEST_GH_DEV_ACCOUNT_PAT }}

slack_workspace_name: ${{ secrets.E2E_DEV_SLACK_WORKSPACE_NAME }}
slack_email: ${{ secrets.E2E_DEV_SLACK_EMAIL }}
slack_password: ${{ secrets.E2E_DEV_SLACK_USER_PASSWORD }}
slack_bot_display_name: "BotkubeDev"
slack_tester_bot_token: ${{ secrets.E2E_DEV_SLACK_TESTER_BOT_TOKEN }}
slack_tester_bot_name: "botkubedev"

botkube_cloud_api_base_url: "https://api-dev.botkube.io"
botkube_cloud_email: ${{ secrets.E2E_DEV_BOTKUBE_CLOUD_EMAIL }}
botkube_cloud_password: ${{ secrets.E2E_DEV_BOTKUBE_CLOUD_PASSWORD }}
botkube_cloud_team_organization_id: ${{ secrets.E2E_DEV_BOTKUBE_CLOUD_TEAM_ORGANIZATION_ID }}

slack_token: ${{ secrets.SLACK_APP_TOKEN_FOR_CI_ALERTS }}
e2e_type: "DEV"
1 change: 1 addition & 0 deletions test/cloud-slack-dev-e2e/cloud_slack_dev_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ func TestCloudSlackE2E(t *testing.T) {
gqlCli := createGQLCli(t, cfg, botkubeCloudPage)
botkubeCloudPage.Cleanup(t, gqlCli)
})
t.FailNow()
botkubeCloudPage.InstallAgentInCluster(t, cfg.BotkubeCliBinaryPath)
botkubeCloudPage.OpenSlackAppIntegrationPage(t)

Expand Down

0 comments on commit f3c9a6f

Please sign in to comment.