diff --git a/.github/scripts/slackHelper.sh b/.github/scripts/slackHelper.sh new file mode 100644 index 000000000000..4696cebcf13b --- /dev/null +++ b/.github/scripts/slackHelper.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +function sendSlackMessage() { + + WEBHOOK_URL="$1" + PIPELINE_URL="$2" + + curl -X POST -H "Content-type: application/json" --data "{ + \"blocks\": [ + { + \"type\": \"section\", + \"text\": { + \"type\": \"mrkdwn\", + \"text\": \"\ +🚨 *CI/CD failure at <$PIPELINE_URL|NeMo CI>*: + +\" + } + } + ] + }" $WEBHOOK_URL + +} diff --git a/.github/workflows/cicd-main.yml b/.github/workflows/cicd-main.yml index dbc7d907580a..53e92e976240 100644 --- a/.github/workflows/cicd-main.yml +++ b/.github/workflows/cicd-main.yml @@ -6482,9 +6482,8 @@ jobs: - uses: "NVIDIA/NeMo/.github/actions/cancel-workflow@main" if: "failure()" - Nemo_CICD_Test: - needs: + needs: - L0_Unit_Tests_GPU - L0_Unit_Tests_CPU - L2_Community_LLM_Checkpoints_tests_Llama @@ -6598,8 +6597,22 @@ jobs: - L2_TTS_Fast_dev_runs_1_Mixer-TTS - L2_TTS_Fast_dev_runs_1_Hifigan - Speech_Checkpoints_tests - + if: always() runs-on: ubuntu-latest steps: # This should depend on all the tests so we block/unblock based on all tests passing - - run: exit 0 + - if: ${{ contains(needs.*.result, 'success') }} + run: exit 0 + + - if: ${{ contains(needs.*.result, 'failure') }} + name: Checkout repository + uses: actions/checkout@v4 + + - if: ${{ contains(needs.*.result, 'failure') }} + run: | + source .github/scripts/slackHelper.sh + + WEBHOOK_URL=${{ secrets.SLACK_WEBHOOK }} + PIPELINE_URL=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} + + sendSlackMessage "$WEBHOOK_URL" "$PIPELINE_URL"