Skip to content

Commit

Permalink
DR-3406: Update slack notify action: Correct branch; Move status chec…
Browse files Browse the repository at this point in the history
…k 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
  • Loading branch information
snf2ye authored Jan 12, 2024
1 parent 27dcb28 commit 6ca8a80
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/dev-image-update.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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' }}
2 changes: 2 additions & 0 deletions .github/workflows/helmtagbump.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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' }}

9 changes: 6 additions & 3 deletions .github/workflows/notify-slack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ env:
on:
workflow_call:
inputs:
success:
required: true
type: boolean
workflow_name:
required: true
type: string
Expand All @@ -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/[email protected]
with:
channel-id: ${{ inputs.failure_slack_channel_id }}
Expand All @@ -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/[email protected]
with:
channel-id: ${{ inputs.success_slack_channel_id }}
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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' }}
2 changes: 2 additions & 0 deletions .github/workflows/test-unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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' }}

0 comments on commit 6ca8a80

Please sign in to comment.