From 6ca8a80969e1d65b8f5df70ba983a512834ca2f4 Mon Sep 17 00:00:00 2001 From: Shelby Holden Date: Fri, 12 Jan 2024 16:06:05 -0500 Subject: [PATCH] DR-3406: Update slack notify action: Correct branch; Move status check to action call (#1588) * wrong branch * Pass in status of job from calling action step Correct branch for jade-data-ui * switch to always to avoid confusion wip --- .github/workflows/dev-image-update.yaml | 2 ++ .github/workflows/helmtagbump.yaml | 2 ++ .github/workflows/notify-slack.yaml | 9 ++++++--- .github/workflows/test-e2e.yml | 2 ++ .github/workflows/test-unit.yml | 2 ++ 5 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dev-image-update.yaml b/.github/workflows/dev-image-update.yaml index 11b9c2cb7..107368100 100644 --- a/.github/workflows/dev-image-update.yaml +++ b/.github/workflows/dev-image-update.yaml @@ -102,6 +102,8 @@ jobs: needs: [ update_image, helm_tag_bump, cherry_pick_image_to_production_gcr ] uses: ./.github/workflows/notify-slack.yaml secrets: inherit + if: ${{ always() }} with: workflow_name: Dev Image Update notify_on_success: true + success: ${{ needs.update_image.result == 'success' && needs.helm_tag_bump.result == 'success' && needs.cherry_pick_image_to_production_gcr.result == 'success' }} diff --git a/.github/workflows/helmtagbump.yaml b/.github/workflows/helmtagbump.yaml index 85e66a289..56d20c4dd 100644 --- a/.github/workflows/helmtagbump.yaml +++ b/.github/workflows/helmtagbump.yaml @@ -113,8 +113,10 @@ jobs: needs: [ integration_helm_tag_update, ui_helm_default_chart_tag ] uses: ./.github/workflows/notify-slack.yaml secrets: inherit + if: ${{ always() }} with: workflow_name: Helm Tag Bump notify_on_failure: ${{ inputs.notify-slack }} notify_on_success: ${{ inputs.notify-slack }} + success: ${{ needs.integration_helm_tag_update.result == 'success' && needs.ui_helm_default_chart_tag.result == 'success' }} diff --git a/.github/workflows/notify-slack.yaml b/.github/workflows/notify-slack.yaml index 1a15e493d..c0a2052b9 100644 --- a/.github/workflows/notify-slack.yaml +++ b/.github/workflows/notify-slack.yaml @@ -5,6 +5,9 @@ env: on: workflow_call: inputs: + success: + required: true + type: boolean workflow_name: required: true type: string @@ -27,10 +30,10 @@ on: jobs: notify-slack: runs-on: ubuntu-latest - if: ${{ !cancelled() && github.ref == 'refs/heads/dev' }} + if: ${{ github.ref == 'refs/heads/develop' }} steps: - name: Notify slack on failure - if: inputs.notify_on_failure && failure() + if: ${{ inputs.notify_on_failure && !inputs.success }} uses: slackapi/slack-github-action@v1.24.0 with: channel-id: ${{ inputs.failure_slack_channel_id }} @@ -55,7 +58,7 @@ jobs: env: SLACK_BOT_TOKEN: ${{ env.SLACK_BOT_TOKEN}} - name: Notify slack on Success - if: inputs.notify_on_success && success() + if: ${{ inputs.notify_on_success && inputs.success }} uses: slackapi/slack-github-action@v1.24.0 with: channel-id: ${{ inputs.success_slack_channel_id }} diff --git a/.github/workflows/test-e2e.yml b/.github/workflows/test-e2e.yml index 89f53e546..cfee0ca62 100644 --- a/.github/workflows/test-e2e.yml +++ b/.github/workflows/test-e2e.yml @@ -118,8 +118,10 @@ jobs: needs: [e2e_test] uses: ./.github/workflows/notify-slack.yaml secrets: inherit + if: ${{ always() }} with: workflow_name: Nightly E2E Tests notify_on_success: true failure_slack_channel_id: "CMYTGJVFY,C53JYBV9A" # #jade-alerts & #dsde-qa success_slack_channel_id: "CK9M0ENRJ,C53JYBV9A" # #jade-spam & #dsde-qa + success: ${{ needs.e2e_test.result == 'success' }} diff --git a/.github/workflows/test-unit.yml b/.github/workflows/test-unit.yml index b6d66aeb4..ff140f2f6 100644 --- a/.github/workflows/test-unit.yml +++ b/.github/workflows/test-unit.yml @@ -37,6 +37,8 @@ jobs: needs: [ unit_test ] uses: ./.github/workflows/notify-slack.yaml secrets: inherit + if: ${{ always() }} with: workflow_name: Nightly Unit Tests notify_on_success: true + success: ${{ needs.unit_test.result == 'success' }}