Skip to content

Commit 548629e

Browse files
Initial commit.
1 parent e2b8573 commit 548629e

1 file changed

Lines changed: 120 additions & 1 deletion

File tree

.github/workflows/release-and-deploy-bfd.yml

Lines changed: 120 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,43 @@ defaults:
3333
run:
3434
shell: bash
3535

36+
# -------------------------
37+
# START NOTIFICATION
38+
# -------------------------
3639
jobs:
40+
notify-start:
41+
runs-on: ubuntu-latest
42+
steps:
43+
- name: Configure AWS credentials
44+
uses: aws-actions/configure-aws-credentials@v4
45+
with:
46+
role-to-assume: ${{ secrets.AWS_ROLE }}
47+
aws-region: ${{ vars.AWS_REGION }}
48+
49+
- name: Load Slack webhook
50+
uses: cmsgov/cdap/actions/aws-params-env-action@main
51+
with:
52+
params: |
53+
SLACK_WEBHOOK_URL=/bfd/platform/alerting/sensitive/slack/bfd-notices/webhook
54+
55+
- name: Slack - STARTED
56+
uses: rtCamp/action-slack-notify@v2
57+
env:
58+
SLACK_WEBHOOK: ${{ env.SLACK_WEBHOOK_URL }}
59+
SLACK_USERNAME: BFD Deploy Bot
60+
SLACK_ICON_EMOJI: ":rocket:"
61+
SLACK_COLOR: "#FFFF00"
62+
SLACK_TITLE: ":hourglass_flowing_sand: BFD Release STARTED"
63+
SLACK_MESSAGE: |
64+
Version: *${{ inputs.release-version || 'latest' }}*
65+
Triggered by: ${{ github.actor }}
66+
${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
67+
68+
# -------------------------
69+
# BUILD
70+
# -------------------------
3771
build-release:
72+
needs: notify-start
3873
if: ${{ github.ref_name == github.event.repository.default_branch }}
3974
uses: ./.github/workflows/build-release.yml
4075
with:
@@ -43,9 +78,12 @@ jobs:
4378
awsRegion: ${{ inputs.aws-region }}
4479
secrets: inherit
4580

81+
# -------------------------
82+
# DEPLOYMENTS
83+
# -------------------------
4684
deploy-platform:
4785
uses: ./.github/workflows/deploy-platform-services.yml
48-
needs: [build-release]
86+
needs: build-release
4987
strategy:
5088
matrix:
5189
account-type: ["prod", "non-prod"]
@@ -77,3 +115,84 @@ jobs:
77115
bfd-env: prod
78116
git-ref: refs/tags/${{ needs.build-release.outputs.bfd_release }}
79117
secrets: inherit
118+
119+
# -------------------------
120+
# Final Slack Notification Summary
121+
# -------------------------
122+
workflow-summary:
123+
name: Final Slack Summary
124+
runs-on: ubuntu-latest
125+
needs:
126+
- build-release
127+
- deploy-platform
128+
- deploy-to-test
129+
- deploy-to-sandbox
130+
- deploy-to-prod
131+
if: always()
132+
133+
steps:
134+
- name: Configure AWS credentials
135+
uses: aws-actions/configure-aws-credentials@v4
136+
with:
137+
role-to-assume: ${{ secrets.AWS_ROLE }}
138+
aws-region: ${{ vars.AWS_REGION }}
139+
140+
- name: Load Slack webhook
141+
uses: cmsgov/cdap/actions/aws-params-env-action@main
142+
with:
143+
params: |
144+
SLACK_WEBHOOK_URL=/bfd/platform/alerting/sensitive/slack/bfd-notices/webhook
145+
146+
# -------------------------
147+
# DETERMINE STATUS
148+
# -------------------------
149+
- name: Compute status
150+
id: status
151+
run: |
152+
if [[ "${{ needs.build-release.result }}" != "success" ]]; then
153+
echo "status=FAILED" >> $GITHUB_OUTPUT
154+
echo "failed_stage=build-release" >> $GITHUB_OUTPUT
155+
elif [[ "${{ needs.deploy-platform.result }}" != "success" ]]; then
156+
echo "status=FAILED" >> $GITHUB_OUTPUT
157+
echo "failed_stage=deploy-platform" >> $GITHUB_OUTPUT
158+
elif [[ "${{ needs.deploy-to-test.result }}" != "success" ]]; then
159+
echo "status=FAILED" >> $GITHUB_OUTPUT
160+
echo "failed_stage=deploy-to-test" >> $GITHUB_OUTPUT
161+
elif [[ "${{ needs.deploy-to-sandbox.result }}" != "success" ]]; then
162+
echo "status=FAILED" >> $GITHUB_OUTPUT
163+
echo "failed_stage=deploy-to-sandbox" >> $GITHUB_OUTPUT
164+
elif [[ "${{ needs.deploy-to-prod.result }}" != "success" ]]; then
165+
echo "status=FAILED" >> $GITHUB_OUTPUT
166+
echo "failed_stage=deploy-to-prod" >> $GITHUB_OUTPUT
167+
else
168+
echo "status=SUCCESS" >> $GITHUB_OUTPUT
169+
echo "failed_stage=none" >> $GITHUB_OUTPUT
170+
fi
171+
172+
# TODO: Reevaluate after trying this out a couple of times whether we need to prune it or alter it.
173+
# -------------------------
174+
# Send Slack
175+
# -------------------------
176+
- name: Slack - FINAL SUMMARY
177+
uses: rtCamp/action-slack-notify@v2
178+
env:
179+
SLACK_WEBHOOK: ${{ env.SLACK_WEBHOOK_URL }}
180+
SLACK_USERNAME: BFD Deploy Bot
181+
SLACK_ICON_EMOJI: ":checkered_flag:"
182+
SLACK_COLOR: ${{ steps.status.outputs.status == 'SUCCESS' && 'good' || 'danger' }}
183+
SLACK_TITLE: ${{ steps.status.outputs.status == 'SUCCESS' && ':white_check_mark: BFD Deploy SUCCESS' || ':x: BFD Deploy FAILED' }}
184+
SLACK_MESSAGE: |
185+
${{ steps.status.outputs.status == 'FAILED' && '@bfd-engineers' || '' }}
186+
187+
*Status:* ${{ steps.status.outputs.status }}
188+
*Version:* ${{ inputs.release-version || 'latest' }}
189+
*Failed Stage:* ${{ steps.status.outputs.failed_stage }}
190+
191+
*Build:* ${{ needs.build-release.result }}
192+
*Platform:* ${{ needs.deploy-platform.result }}
193+
*Test:* ${{ needs.deploy-to-test.result }}
194+
*Sandbox:* ${{ needs.deploy-to-sandbox.result }}
195+
*Prod:* ${{ needs.deploy-to-prod.result }}
196+
197+
${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
198+

0 commit comments

Comments
 (0)