Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DEVOPS- 1714] - Add the Commit SHA of the Branch or Tag Deployed to Slack Messages #235

Merged
merged 4 commits into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Test report-deployment-status-to-slack
on:
pull_request:
paths:
- "./report-deployment-status-to-slack"
- "./report-deployment-status-to-slack/**"
- ".github/workflows/test-report-deployment-status-to-slack.yml"

jobs:
Expand All @@ -20,6 +20,7 @@ jobs:
tag: test-workflow-start
slack-channel: devops-alerts-test
event: 'start'
commit-sha: ${{ github.sha }}
url: https://github.com/bitwarden/gh-actions/actions/runs/${{ github.run_id }}
AZURE_KV_CI_SERVICE_PRINCIPAL: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}

Expand All @@ -36,6 +37,7 @@ jobs:
tag: test-workflow-success
slack-channel: devops-alerts-test
event: 'success'
commit-sha: ${{ github.sha }}
url: https://github.com/bitwarden/gh-actions/actions/runs/${{ github.run_id }}
AZURE_KV_CI_SERVICE_PRINCIPAL: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}

Expand All @@ -52,6 +54,7 @@ jobs:
tag: test-workflow-failure
slack-channel: devops-alerts-test
event: 'failure'
commit-sha: ${{ github.sha }}
url: https://github.com/bitwarden/gh-actions/actions/runs/${{ github.run_id }}
AZURE_KV_CI_SERVICE_PRINCIPAL: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}

13 changes: 10 additions & 3 deletions report-deployment-status-to-slack/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ inputs:
tag:
description: "The name of the branch or tag."
required: true
commit-sha:
description: "The SHA of the branch or tag."
required: true
environment:
description: "The name of the environment."
required: true
Expand Down Expand Up @@ -56,23 +59,27 @@ runs:
case "${{ inputs.event }}" in
start)
SLACK_MESSAGE=":loading: Updating ${{ inputs.environment }} to \`${{ inputs.tag }}\` on ${{ inputs.project }}.
${{ inputs.url }}"
${{ inputs.url }}
SHA: \`${{ inputs.commit-sha }}\`"
;;

success)
SLACK_MESSAGE=":white_check_mark: Updated ${{ inputs.environment }} to \`${{ inputs.tag }}\` on ${{ inputs.project }}.
${{ inputs.url }}"
${{ inputs.url }}
SHA: \`${{ inputs.commit-sha }}\`"
;;

failure)
SLACK_MESSAGE=":x: Failed to update ${{ inputs.environment }} to \`${{ inputs.tag }}\` on ${{ inputs.project }}.
${{ inputs.url }}
SHA: \`${{ inputs.commit-sha }}\`
Please retry or contact @devops team."
;;

cancelled)
SLACK_MESSAGE=":hand: Cancelled update of ${{ inputs.environment }} to \`${{ inputs.tag }}\` on ${{ inputs.project }}.
${{ inputs.url }}"
${{ inputs.url }}
SHA: \`${{ inputs.commit-sha }}\`"
;;
esac

Expand Down