-
Notifications
You must be signed in to change notification settings - Fork 966
101 lines (97 loc) · 3.55 KB
/
post_deploy_asset_check.yml
File metadata and controls
101 lines (97 loc) · 3.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
name: Post-deploy asset check
run-name: Asset check for ${{ inputs.branch }} @ ${{ inputs.git_sha }}
env:
SLACK_CHANNEL_ID: CBX0KH5GA # #www-notify in MoCo Slack
SLACK_BOT_TOKEN: ${{secrets.SLACK_BOT_TOKEN_FOR_MEAO_NOTIFICATIONS_APP}}
on:
workflow_dispatch:
inputs:
branch:
description: Branch of mozilla/bedrock that was deployed (eg. main|stage|prod)
required: true
git_sha:
description: Git SHA that was deployed
required: true
origin_hostname:
description: Fully qualified base URL for the origin server
required: true
cdn_hostname:
description: Fully qualified base URL for the CDN (eg. https://www.mozilla.org)
required: true
jobs:
notify-of-checks-start:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
sparse-checkout: |
.github/actions/slack
- name: Notify via Slack that tests are starting
uses: ./.github/actions/slack
with:
channel_id: ${{ env.SLACK_CHANNEL_ID }}
env_name: test
label: "Static-assets check for [${{ inputs.git_sha }}]"
message: "Static-assets check started"
ref: ${{ inputs.branch }}
slack_bot_token: ${{ env.SLACK_BOT_TOKEN }}
status: info
asset-check:
runs-on: ubuntu-latest
env:
GIT_SHA: ${{ inputs.git_sha }}
ORIGIN_HOSTNAME: ${{ inputs.origin_hostname }}
CDN_HOSTNAME: ${{ inputs.cdn_hostname }}
steps:
- name: Pull release image
run: docker pull mozmeao/bedrock:$GIT_SHA
- name: Verify deployed assets are available
run: |
docker run --rm \
mozmeao/bedrock:$GIT_SHA \
python manage.py check_static_assets \
--origin-host "$ORIGIN_HOSTNAME" \
--cdn-host "$CDN_HOSTNAME" \
--manifest-path static/staticfiles.json
notify-of-checks-completion:
if: always()
runs-on: ubuntu-latest
needs: [asset-check]
steps:
- uses: actions/checkout@v5
with:
sparse-checkout: |
.github/actions/slack
- name: Notify via Slack of test-run success
if: ${{ needs.asset-check.result == 'success' }}
uses: ./.github/actions/slack
with:
channel_id: ${{ env.SLACK_CHANNEL_ID }}
env_name: test
label: "Static-assets checks for [${{ inputs.git_sha }}]"
message: "Static-assets check completed. Status: success"
ref: ${{ inputs.branch }}
slack_bot_token: ${{ env.SLACK_BOT_TOKEN }}
status: "success"
- name: Notify via Slack of test-run failure
if: ${{ needs.asset-check.result == 'failure' }}
uses: ./.github/actions/slack
with:
channel_id: ${{ env.SLACK_CHANNEL_ID }}
env_name: test
label: "Static-assets checks for [${{ inputs.git_sha }}]"
message: "Static-assets check completed. Status: failure"
ref: ${{ inputs.branch }}
slack_bot_token: ${{ env.SLACK_BOT_TOKEN }}
status: "failure"
- name: Notify via Slack of test-run cancelled
if: ${{ needs.asset-check.result == 'cancelled' }}
uses: ./.github/actions/slack
with:
env_name: test
label: "Static-assets checks for [${{ inputs.git_sha }}]"
status: "cancelled"
channel_id: ${{ env.SLACK_CHANNEL_ID }}
slack_bot_token: ${{ env.SLACK_BOT_TOKEN }}
ref: ${{ inputs.branch }}
message: "Static-assets check completed. Status: cancelled"