Browse Source

[DEVOPS-1651] Update the QA deployment alert at the start (#215)

* Change input and add start message

* Change test workflow

* Simplify action

* Fix

* Fix

* Fix

* Fix

* Fix

* Fix

* Change to markdown

* Fix

* CHange styling

* Change channel for tests
pull/216/head
Michał Chęciński 2 years ago committed by GitHub
parent
commit
4b5492c3ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 29
      .github/workflows/test-report-deployment-status-to-slack.yml
  2. 28
      report-deployment-status-to-slack/action.yml

29
.github/workflows/test-report-deployment-status-to-slack.yml

@ -7,6 +7,22 @@ on: @@ -7,6 +7,22 @@ on:
- ".github/workflows/test-report-deployment-status-to-slack.yml"
jobs:
test-report-start:
name: Test Slack report failure
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
- uses: ./report-deployment-status-to-slack
with:
project: Server
environment: US QA Cloud
tag: test-workflow-start
slack-channel: devops-alerts-test
event: 'start'
url: https://github.com/bitwarden/gh-actions/actions/runs/${{ github.run_id }}
AZURE_KV_CI_SERVICE_PRINCIPAL: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
test-report:
name: Test Slack report
runs-on: ubuntu-22.04
@ -15,10 +31,12 @@ jobs: @@ -15,10 +31,12 @@ jobs:
- uses: ./report-deployment-status-to-slack
with:
project: Server
environment: US QA Cloud
tag: test-workflow
slack-channel: devops-alerts
failure: false
tag: test-workflow-success
slack-channel: devops-alerts-test
event: 'success'
url: https://github.com/bitwarden/gh-actions/actions/runs/${{ github.run_id }}
AZURE_KV_CI_SERVICE_PRINCIPAL: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
test-report-failure:
@ -32,7 +50,8 @@ jobs: @@ -32,7 +50,8 @@ jobs:
project: Server
environment: US QA Cloud
tag: test-workflow-failure
slack-channel: devops-alerts
failure: true
slack-channel: devops-alerts-test
event: 'failure'
url: https://github.com/bitwarden/gh-actions/actions/runs/${{ github.run_id }}
AZURE_KV_CI_SERVICE_PRINCIPAL: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}

28
report-deployment-status-to-slack/action.yml

@ -13,10 +13,13 @@ inputs: @@ -13,10 +13,13 @@ inputs:
description: "The name of the slack channel."
required: true
default: team-eng-qa-devops
failure:
description: "If message should be a failure message"
event:
description: "Deployment event type. Possible values are start, success, or failure."
required: true
url:
description: "Deployment event type. Possible values are start, success, or failure."
required: false
default: 'false'
default: ${{ github.event.deployment_status.target_url }}
AZURE_KV_CI_SERVICE_PRINCIPAL:
description: "The service principal used to authenticate to Azure."
required: true
@ -25,7 +28,7 @@ runs: @@ -25,7 +28,7 @@ runs:
using: "composite"
steps:
- name: Login to Azure - Prod Subscription
uses: Azure/login@4c88f01b0e3a5600e08a37889921afd060f75cf0 # v1.5.0
uses: Azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 # v1.4.7
with:
creds: ${{ inputs.AZURE_KV_CI_SERVICE_PRINCIPAL }}
@ -36,20 +39,29 @@ runs: @@ -36,20 +39,29 @@ runs:
keyvault: bitwarden-ci
secrets: "slack-bot-token"
- name: Post to a Slack channel on start
if: ${{ inputs.event == 'start' }}
uses: slackapi/slack-github-action@e28cf165c92ffef168d23c5c9000cffc8a25e117 # v1.24.0
with:
channel-id: ${{ inputs.slack-channel }}
slack-message: ":loading: Updating ${{ inputs.environment }} to `${{ inputs.tag }}` on ${{ inputs.project }}.\n ${{ inputs.url }}."
env:
SLACK_BOT_TOKEN: ${{ steps.retrieve-slack-secrets.outputs.slack-bot-token }}
- name: Post to a Slack channel on success
if: ${{ inputs.failure == 'false' }}
if: ${{ inputs.event == 'success' }}
uses: slackapi/slack-github-action@e28cf165c92ffef168d23c5c9000cffc8a25e117 # v1.24.0
with:
channel-id: ${{ inputs.slack-channel }}
slack-message: ":white_check_mark: Updated ${{ inputs.environment }} to `${{ inputs.tag }}` on ${{ inputs.project }}."
slack-message: ":white_check_mark: Updated ${{ inputs.environment }} to `${{ inputs.tag }}` on ${{ inputs.project }}.\n ${{ inputs.url }}."
env:
SLACK_BOT_TOKEN: ${{ steps.retrieve-slack-secrets.outputs.slack-bot-token }}
- name: Post to a Slack channel on failure
if: ${{ inputs.failure == 'true' }}
if: ${{ inputs.event == 'failure' }}
uses: slackapi/slack-github-action@e28cf165c92ffef168d23c5c9000cffc8a25e117 # v1.24.0
with:
channel-id: ${{ inputs.slack-channel }}
slack-message: ":x: Failed to update ${{ inputs.environment }} to `${{ inputs.tag }}` on ${{ inputs.project }}.\nPlease retry or contact @devops team."
slack-message: ":x: Failed to update ${{ inputs.environment }} to `${{ inputs.tag }}` on ${{ inputs.project }}.\n ${{ inputs.url }}.\nPlease retry or contact @devops team."
env:
SLACK_BOT_TOKEN: ${{ steps.retrieve-slack-secrets.outputs.slack-bot-token }}
Loading…
Cancel
Save