Skip to content

Commit

Permalink
Share the cloud slack e2e workflow between jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
mszostok committed Jan 31, 2024
1 parent 9feeb00 commit c76f74b
Show file tree
Hide file tree
Showing 3 changed files with 434 additions and 377 deletions.
126 changes: 126 additions & 0 deletions .github/actions/cloud-slack-e2e/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
name: Runs e2e Cloud Slack tests
description: Runs e2e Cloud Slack tests

inputs:
access_token:
description: GitHub personal access token used for cloning private repositories
required: true

slack_workspace_name:
description: 'Slack Workspace Name'
required: true
slack_email:
description: 'Slack Email'
required: true
slack_password:
description: 'Slack Password'
required: true
slack_tester_bot_token:
description: 'Slack Tester Bot Token'
required: true
slack_bot_display_name:
description: 'Slack Bot Display Name'
required: true
slack_tester_bot_name:
description: 'Slack Tester Bot Name'
required: true

botkube_cloud_api_base_url:
description: 'BotKube Cloud API Base URL'
required: true
botkube_cloud_email:
description: 'BotKube Cloud Email'
required: true
botkube_cloud_password:
description: 'BotKube Cloud Password'
required: true
botkube_cloud_team_organization_id:
description: 'BotKube Cloud Team Organization ID'
required: true
botkube_cloud_free_organization_id:
description: 'BotKube Cloud Free Organization ID'
required: true
botkube_cloud_plugin_repo_url:
description: 'BotKube Cloud Plugin Repo URL'
required: true

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

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

runs:
using: "composite"
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Helm
uses: azure/setup-helm@v3
with:
version: ${{ env.HELM_VERSION }}

- 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
shell: bash
run: "k3d cluster create cloud-slack-e2e-cluster --wait --timeout=5m"

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

- name: Run e2e 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: 90s


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 }}
BOTKUBE_CLOUD_FREE_ORGANIZATION_ID: ${{ inputs.botkube_cloud_free_organization_id }}
BOTKUBE_CLOUD_PLUGIN_REPO_URL: ${{ inputs.botkube_cloud_plugin_repo_url }}
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@v3
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

- 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: '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_WEBHOOK: ${{ inputs.slack_alerts_webhook }}
Loading

0 comments on commit c76f74b

Please sign in to comment.