You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ci(frontend-deploy): report every deploy outcome in one Slack message
The deploy channel carried three messages per deploy: a run started card and
a succeeded card from the GitHub Slack app, plus this notification. The
succeeded card said nothing this one does not already say, with less detail.
Dropping the app subscription would have lost the two states this job never
covered, so cover them here instead. The job now runs on always() and reports
deployed, failed, or cancelled, and the outcome message carries the run start
time and duration so a separate start notification is not needed either.
Cancellation gets its own wording rather than the red cross the app used for
it. Job level concurrency stops a run in progress whenever the next commit
lands on main, so most cancellations are a supersede and nothing is wrong.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
# jq builds the payload so every value is escaped for us, rather than
66
+
# interpolated into a JSON heredoc.
36
67
jq -n \
37
68
--arg service "$SERVICE" \
38
69
--arg environment "$ENVIRONMENT" \
70
+
--arg status "$STATUS" \
39
71
--arg short_sha "${COMMIT_SHA:0:7}" \
40
72
--arg actor "$ACTOR" \
41
73
--arg app_url "$APP_URL" \
42
74
--arg workflow_url "$WORKFLOW_URL" \
75
+
--arg started_epoch "$started_epoch" \
76
+
--arg started_label "$started_label" \
77
+
--arg duration "$duration" \
43
78
'($environment | (.[0:1] | ascii_upcase) + .[1:]) as $env_name |
79
+
(if $status == "failed" then
80
+
{
81
+
headline: "🛑 \($service) deploy to \($environment) failed",
82
+
body: "\($env_name) is unchanged and still serving the previous release.",
83
+
actor_label: "Pushed by",
84
+
link_app: false
85
+
}
86
+
elif $status == "cancelled" then
87
+
{
88
+
headline: "⏭️ \($service) deploy to \($environment) stopped",
89
+
# Job level concurrency cancels a run in progress when the next
90
+
# commit lands, which is the usual reason to see this.
91
+
body: "This run was cancelled before deploying, usually because a newer commit landed on main. \($env_name) is unchanged, and the newer run deploys instead.",
92
+
actor_label: "Pushed by",
93
+
link_app: false
94
+
}
95
+
else
96
+
{
97
+
headline: "🚀 \($service) deployed to \($environment)",
98
+
body: "🧪 *\($env_name) smoke test required*\n\nPlease verify the application directly in \($environment).",
99
+
actor_label: "Deployed by",
100
+
link_app: true
101
+
}
102
+
end) as $copy |
44
103
{
45
104
# Slack honours username on this webhook but ignores icon_emoji.
46
105
# The avatar comes from the icon set on the Slack app itself.
47
106
username: "\($service) Deploy",
48
-
text: "🚀 \($service) deployed to \($environment): smoke test required",
0 commit comments