diff --git a/.github/workflows/k6.yml b/.github/workflows/k6.yml index 3633df0..a32a658 100644 --- a/.github/workflows/k6.yml +++ b/.github/workflows/k6.yml @@ -14,7 +14,7 @@ jobs: uses: actions/checkout@v1 - name: Start containers - run: docker compose -f docker-compose.k6.workflows.yml up -d + run: docker compose -f docker-compose.k6.workflows.yml run k6-tracetest env: TRACETEST_API_TOKEN: ${{secrets.TRACETEST_TOKEN}} POKESHOP_DEMO_URL: ${{secrets.POKESHOP_DEMO_URL}} @@ -22,3 +22,38 @@ jobs: - name: Stop containers if: always() run: docker compose -f docker-compose.k6.workflows.yml down + - name: Send message on Slack in case of failure + if: ${{ failure() }} + uses: slackapi/slack-github-action@v1.24.0 + with: + # check the block kit builder docs to understand how it works + # and how to modify it: https://api.slack.com/block-kit + payload: | + { + "blocks": [ + { + "type": "header", + "text": { + "type": "plain_text", + "text": ":warning: Synthetic Monitoring Alert - K6 - Pokeshop Demo :warning:", + "emoji": true + } + }, + { + "type": "section", + "fields": [ + { + "type": "mrkdwn", + "text": "*Status:*\nFailed" + }, + { + "type": "mrkdwn", + "text": "*Pipeline:*\n<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View workflow>" + } + ] + } + ] + } + env: + SLACK_WEBHOOK_URL: ${{ secrets.SYNTETIC_MONITORING_SLACK_WEBHOOK_URL }} + SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK