From 5336223b08e5f774a0ce9ea53dc18aa1daed260e Mon Sep 17 00:00:00 2001 From: Opeyemi Alao <54288773+Eeebru@users.noreply.github.com> Date: Tue, 16 Jan 2024 14:48:58 +0000 Subject: [PATCH 1/4] Add the Commit sha of the branch or tag deployed --- report-deployment-status-to-slack/action.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/report-deployment-status-to-slack/action.yml b/report-deployment-status-to-slack/action.yml index 66d41a7e..85d6c079 100644 --- a/report-deployment-status-to-slack/action.yml +++ b/report-deployment-status-to-slack/action.yml @@ -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 @@ -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 From 32d164e5271083686f3a4105a59241fe94d819c3 Mon Sep 17 00:00:00 2001 From: Opeyemi Alao <54288773+Eeebru@users.noreply.github.com> Date: Tue, 16 Jan 2024 16:20:37 +0000 Subject: [PATCH 2/4] Update the Slack deployment status trigger --- .github/workflows/test-report-deployment-status-to-slack.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-report-deployment-status-to-slack.yml b/.github/workflows/test-report-deployment-status-to-slack.yml index e152ffdc..bf437807 100644 --- a/.github/workflows/test-report-deployment-status-to-slack.yml +++ b/.github/workflows/test-report-deployment-status-to-slack.yml @@ -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: From 4458fc820b96b107ef40c3364bfbe8c777331327 Mon Sep 17 00:00:00 2001 From: Opeyemi Alao <54288773+Eeebru@users.noreply.github.com> Date: Tue, 16 Jan 2024 16:22:42 +0000 Subject: [PATCH 3/4] UPDATE: add commit sha to the test wf --- .github/workflows/test-report-deployment-status-to-slack.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test-report-deployment-status-to-slack.yml b/.github/workflows/test-report-deployment-status-to-slack.yml index bf437807..dca909ab 100644 --- a/.github/workflows/test-report-deployment-status-to-slack.yml +++ b/.github/workflows/test-report-deployment-status-to-slack.yml @@ -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 }} @@ -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 }} @@ -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 }} From 4570c6668e816ea297894ea6aa71efbbc95bc91d Mon Sep 17 00:00:00 2001 From: Opeyemi Alao <54288773+Eeebru@users.noreply.github.com> Date: Tue, 16 Jan 2024 16:27:57 +0000 Subject: [PATCH 4/4] UPDATE: format the commit sha --- report-deployment-status-to-slack/action.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/report-deployment-status-to-slack/action.yml b/report-deployment-status-to-slack/action.yml index 85d6c079..330c586a 100644 --- a/report-deployment-status-to-slack/action.yml +++ b/report-deployment-status-to-slack/action.yml @@ -60,26 +60,26 @@ runs: start) SLACK_MESSAGE=":loading: Updating ${{ inputs.environment }} to \`${{ inputs.tag }}\` on ${{ inputs.project }}. ${{ inputs.url }} - SHA: ${{ inputs.commit-sha }}" + SHA: \`${{ inputs.commit-sha }}\`" ;; success) SLACK_MESSAGE=":white_check_mark: Updated ${{ inputs.environment }} to \`${{ inputs.tag }}\` on ${{ inputs.project }}. ${{ inputs.url }} - SHA: ${{ inputs.commit-sha }}" + 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 }} + 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 }} - SHA: ${{ inputs.commit-sha }}" + SHA: \`${{ inputs.commit-sha }}\`" ;; esac