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 915e362
Show file tree
Hide file tree
Showing 2 changed files with 115 additions and 58 deletions.
124 changes: 66 additions & 58 deletions .github/actions/cloud-slack-e2e/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,96 +45,104 @@ inputs:
description: 'Slack Alerts Webhook'
required: true

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

e2e_type:
description: "Type of e2e test"
required: true

runs:
using: "composite"
steps:
- name: Download k3d
shell: bash
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: Download Botkube CLI
shell: bash
run: |
curl -Lo botkube https://github.com/kubeshop/botkube/releases/download/v1.12.0/botkube-linux-amd64
chmod +x botkube
- name: Add Botkube CLI to env
- name: Get example image
shell: bash
run: |
echo BOTKUBE_CLI_BINARY_PATH="$PWD/botkube" >> $GITHUB_ENV
- 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
run: curl https://github.com/kubeshop/botkube/assets/17568639/ad0887b4-6c8e-4d70-8a7a-071745893454 > ${{ runner.temp }}/screenshots/example.png
- name: Download k3d
shell: bash
env:
SLACK_WORKSPACE_NAME: ${{ inputs.slack_workspace_name }}
SLACK_EMAIL: ${{ inputs.slack_email }}
SLACK_PASSWORD: ${{ inputs.slack_password }}
SLACK_TESTER_TESTER_BOT_TOKEN: ${{ inputs.slack_tester_bot_token }}
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
DEBUG_MODE: "true"
run: |
KUBECONFIG=$(k3d kubeconfig write cloud-slack-e2e-cluster) make test-cloud-slack-dev-e2e
run: "exit 1"
# 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: Download Botkube CLI
# shell: bash
# run: |
# curl -Lo botkube https://github.com/kubeshop/botkube/releases/download/v1.12.0/botkube-linux-amd64
# chmod +x botkube
#
# - name: Add Botkube CLI to env
# shell: bash
# run: |
# echo BOTKUBE_CLI_BINARY_PATH="$PWD/botkube" >> $GITHUB_ENV
#
# - 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 }}
# SLACK_EMAIL: ${{ inputs.slack_email }}
# SLACK_PASSWORD: ${{ inputs.slack_password }}
# SLACK_TESTER_TESTER_BOT_TOKEN: ${{ inputs.slack_tester_bot_token }}
# 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
# 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@v4
if: ${{ always() }}
with:
name: screenshots_dump_${{github.sha}}
path: ${{ runner.temp }}/screenshots
retention-days: 5

- name: Dump cluster state
if: ${{ failure() }}
uses: ./.github/actions/dump-cluster
with:
name: cloud-slack-e2e
#
# - name: Dump cluster state
# if: ${{ failure() }}
# uses: ./.github/actions/dump-cluster
# with:
# name: cloud-slack-e2e

- 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_WEBHOOK: ${{ inputs.slack_alerts_webhook }}
SLACK_TOKEN: ${{ inputs.slack_token }}
SLACK_FILE_UPLOAD: ${{ runner.temp }}/screenshots/example.png
49 changes: 49 additions & 0 deletions .github/workflows/test-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
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_alerts_webhook: ${{ secrets.SLACK_CI_ALERTS_WEBHOOK }}
slack_token: ${{ secrets.SLACK_APP_TOKEN_FOR_CI_ALERTS }}
e2e_type: "DEV"

0 comments on commit 915e362

Please sign in to comment.