From 915e362bf9698f46eafa8c45ce847245c76bf4ff Mon Sep 17 00:00:00 2001 From: Mateusz Szostok Date: Mon, 1 Jul 2024 09:47:15 +0200 Subject: [PATCH] Add link to exact run --- .github/actions/cloud-slack-e2e/action.yaml | 124 +++++++++++--------- .github/workflows/test-pr.yml | 49 ++++++++ 2 files changed, 115 insertions(+), 58 deletions(-) create mode 100644 .github/workflows/test-pr.yml diff --git a/.github/actions/cloud-slack-e2e/action.yaml b/.github/actions/cloud-slack-e2e/action.yaml index a3562c0b1..69eb68154 100644 --- a/.github/actions/cloud-slack-e2e/action.yaml +++ b/.github/actions/cloud-slack-e2e/action.yaml @@ -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 @@ -52,54 +56,58 @@ inputs: 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() }} @@ -107,22 +115,19 @@ runs: 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 @@ -130,11 +135,14 @@ runs: 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 diff --git a/.github/workflows/test-pr.yml b/.github/workflows/test-pr.yml new file mode 100644 index 000000000..8d7fd6a96 --- /dev/null +++ b/.github/workflows/test-pr.yml @@ -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" \ No newline at end of file