Skip to content

Commit a93e4c2

Browse files
authored
feat: add summaries (#43)
1 parent 4a1d76c commit a93e4c2

File tree

4 files changed

+114
-12
lines changed

4 files changed

+114
-12
lines changed

β€Ž.github/workflows/_cloud-run-canary-deploy.yml

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ jobs:
371371
echo "Service URL: $SERVICE_URL"
372372
echo "Canary Revision: $CANARY_REVISION"
373373
echo "Traffic allocation:"
374-
gcloud run services describe $ACTUAL_SERVICE_NAME \
374+
TRAFFIC_OUTPUT=$(gcloud run services describe $ACTUAL_SERVICE_NAME \
375375
--region=${{ vars.PULUMI_GAR_LOCATION }} \
376376
--project=${{ vars.PULUMI_GCP_PROJECT_ID }} \
377377
--format='value(spec.traffic[].revisionName,spec.traffic[].percent,spec.traffic[].tag,spec.traffic[].url)' | \
@@ -384,9 +384,33 @@ jobs:
384384
printf " %s: %s%%%s%s\n", revs[i], (percs[i] ? percs[i] : "0"), tag_str, url_str;
385385
}
386386
}
387-
}'
387+
}')
388+
echo "$TRAFFIC_OUTPUT"
388389
echo "================================="
389390
390391
echo "βœ… Canary deployment completed successfully!"
391392
echo "πŸ” Monitor your metrics and use canary-promote workflow to increase traffic"
392-
echo "🚨 Use canary-rollback workflow if issues are detected"
393+
echo "🚨 Use canary-rollback workflow if issues are detected"
394+
395+
# Add summary to GitHub Step Summary
396+
{
397+
echo "## πŸš€ Canary Deployment Summary"
398+
echo ""
399+
echo "βœ… **Status**: Canary deployment completed successfully!"
400+
echo "πŸ“Š **Service URL**: [$SERVICE_URL]($SERVICE_URL)"
401+
echo "🏷️ **Canary Revision**: \`$CANARY_REVISION\`"
402+
echo "πŸ“ˆ **Traffic Percentage**: ${{ inputs.traffic_percentage }}%"
403+
echo ""
404+
echo "### πŸ“Š Traffic Allocation"
405+
echo "\`\`\`"
406+
echo "$TRAFFIC_OUTPUT"
407+
echo "\`\`\`"
408+
echo ""
409+
echo "### 🎯 Next Steps"
410+
echo "- πŸ” Monitor your metrics and performance indicators"
411+
echo "- ⬆️ Use **canary-promote** workflow to increase traffic further"
412+
echo "- βœ… Use **canary-finalize** workflow when ready for 100% traffic"
413+
echo "- 🚨 Use **canary-rollback** workflow if issues are detected"
414+
echo ""
415+
echo "_Canary URL_: [$SERVICE_URL?tag=canary]($SERVICE_URL?tag=canary)"
416+
} >> $GITHUB_STEP_SUMMARY

β€Ž.github/workflows/_cloud-run-canary-finalize.yml

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ jobs:
319319
echo "Current traffic: 100% to stable"
320320
echo "Old revisions cleanup: ${{ inputs.cleanup_old_revisions }}"
321321
echo "Final traffic allocation:"
322-
gcloud run services describe $ACTUAL_SERVICE_NAME \
322+
TRAFFIC_OUTPUT=$(gcloud run services describe $ACTUAL_SERVICE_NAME \
323323
--region=${{ vars.PULUMI_GAR_LOCATION }} \
324324
--project=${{ vars.PULUMI_GCP_PROJECT_ID }} \
325325
--format='value(spec.traffic[].revisionName,spec.traffic[].percent,spec.traffic[].tag)' | \
@@ -328,10 +328,35 @@ jobs:
328328
for(i=1; i<=length(revs); i++) {
329329
if(revs[i] != "") printf " %-24s %s%% %s\n", revs[i], (percs[i] ? percs[i] : "0"), (tags[i] ? tags[i] : "-")
330330
}
331-
}'
331+
}')
332+
echo "$TRAFFIC_OUTPUT"
332333
echo "====================================="
333334
334335
echo "πŸŽ‰ Canary deployment finalized successfully!"
335336
echo "βœ… Your new version is now serving 100% of traffic"
336337
echo "🏷️ Revision tagged as 'stable' for future canary deployments"
337-
echo "🧹 Old revisions cleaned up (if enabled)"
338+
echo "🧹 Old revisions cleaned up (if enabled)"
339+
340+
# Add summary to GitHub Step Summary
341+
{
342+
echo "## πŸŽ‰ Canary Finalization Complete"
343+
echo ""
344+
echo "βœ… **Status**: Canary deployment finalized successfully!"
345+
echo "πŸ“Š **Service URL**: [$SERVICE_URL]($SERVICE_URL)"
346+
echo "🏷️ **New Stable Revision**: \`$NEW_STABLE_REVISION\`"
347+
echo "πŸ“ˆ **Traffic Transition**: ${{ steps.current-status.outputs.current_canary_traffic }}% canary β†’ 100% stable"
348+
echo "🧹 **Cleanup**: $([ \"${{ inputs.cleanup_old_revisions }}\" = \"true\" ] && echo \"Enabled\" || echo \"Disabled\")"
349+
echo ""
350+
echo "### πŸ“Š Final Traffic Allocation"
351+
echo "\`\`\`"
352+
echo "$TRAFFIC_OUTPUT"
353+
echo "\`\`\`"
354+
echo ""
355+
echo "### 🎯 Deployment Complete"
356+
echo "- βœ… Your new version is now serving **100%** of traffic"
357+
echo "- 🏷️ Revision tagged as **stable** for future canary deployments"
358+
echo "- 🧹 Old revisions cleaned up (if enabled)"
359+
echo "- πŸš€ Ready for next development cycle"
360+
echo ""
361+
echo "πŸŽ‰ **Congratulations!** Your canary deployment has been successfully promoted to production."
362+
} >> $GITHUB_STEP_SUMMARY

β€Ž.github/workflows/_cloud-run-canary-promote.yml

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ jobs:
234234
echo "Previous canary traffic: ${{ steps.current-status.outputs.current_canary_traffic }}%"
235235
echo "New canary traffic: ${{ inputs.traffic_percentage }}%"
236236
echo "Current traffic allocation:"
237-
gcloud run services describe $ACTUAL_SERVICE_NAME \
237+
TRAFFIC_OUTPUT=$(gcloud run services describe $ACTUAL_SERVICE_NAME \
238238
--region=${{ vars.PULUMI_GAR_LOCATION }} \
239239
--project=${{ vars.PULUMI_GCP_PROJECT_ID }} \
240240
--format='value(spec.traffic[].revisionName,spec.traffic[].percent,spec.traffic[].tag)' | \
@@ -243,11 +243,34 @@ jobs:
243243
for(i=1; i<=length(revs); i++) {
244244
if(revs[i] != "") printf " %-24s %s%% %s\n", revs[i], (percs[i] ? percs[i] : "0"), (tags[i] ? tags[i] : "-")
245245
}
246-
}'
246+
}')
247+
echo "$TRAFFIC_OUTPUT"
247248
echo "================================="
248249
249250
echo "βœ… Canary promotion completed successfully!"
250251
echo "πŸ“Š Continue monitoring metrics before next promotion"
251252
echo "⬆️ Use canary-promote again to increase traffic further"
252253
echo "βœ… Use canary-finalize when ready for 100% traffic"
253-
echo "🚨 Use canary-rollback if issues are detected"
254+
echo "🚨 Use canary-rollback if issues are detected"
255+
256+
# Add summary to GitHub Step Summary
257+
{
258+
echo "## πŸ“ˆ Canary Promotion Summary"
259+
echo ""
260+
echo "βœ… **Status**: Canary promotion completed successfully!"
261+
echo "πŸ“Š **Service URL**: [$SERVICE_URL]($SERVICE_URL)"
262+
echo "πŸ“ˆ **Traffic Updated**: ${{ steps.current-status.outputs.current_canary_traffic }}% β†’ ${{ inputs.traffic_percentage }}%"
263+
echo ""
264+
echo "### πŸ“Š Current Traffic Allocation"
265+
echo "\`\`\`"
266+
echo "$TRAFFIC_OUTPUT"
267+
echo "\`\`\`"
268+
echo ""
269+
echo "### 🎯 Next Steps"
270+
echo "- πŸ“Š Continue monitoring metrics before next promotion"
271+
echo "- ⬆️ Use **canary-promote** again to increase traffic further"
272+
echo "- βœ… Use **canary-finalize** when ready for 100% traffic"
273+
echo "- 🚨 Use **canary-rollback** if issues are detected"
274+
echo ""
275+
echo "_Canary URL_: [$SERVICE_URL?tag=canary]($SERVICE_URL?tag=canary)"
276+
} >> $GITHUB_STEP_SUMMARY

β€Ž.github/workflows/_cloud-run-canary-rollback.yml

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ jobs:
343343
echo "Current traffic: 100% to stable"
344344
echo "Canary revision cleanup: ${{ inputs.cleanup_canary_revision }}"
345345
echo "Final traffic allocation:"
346-
gcloud run services describe $ACTUAL_SERVICE_NAME \
346+
TRAFFIC_OUTPUT=$(gcloud run services describe $ACTUAL_SERVICE_NAME \
347347
--region=${{ vars.PULUMI_GAR_LOCATION }} \
348348
--project=${{ vars.PULUMI_GCP_PROJECT_ID }} \
349349
--format='value(spec.traffic[].revisionName,spec.traffic[].percent,spec.traffic[].tag)' | \
@@ -352,7 +352,8 @@ jobs:
352352
for(i=1; i<=length(revs); i++) {
353353
if(revs[i] != "") printf " %-24s %s%% %s\n", revs[i], (percs[i] ? percs[i] : "0"), (tags[i] ? tags[i] : "-")
354354
}
355-
}'
355+
}')
356+
echo "$TRAFFIC_OUTPUT"
356357
echo "===================================="
357358
358359
echo "🚨 Emergency rollback completed successfully!"
@@ -363,4 +364,33 @@ jobs:
363364
echo "πŸ” Next steps:"
364365
echo " 1. Investigate the issues that caused the rollback"
365366
echo " 2. Fix the problems in your code"
366-
echo " 3. Deploy a new version when ready"
367+
echo " 3. Deploy a new version when ready"
368+
369+
# Add summary to GitHub Step Summary
370+
{
371+
echo "## 🚨 Emergency Rollback Complete"
372+
echo ""
373+
echo "βœ… **Status**: Emergency rollback completed successfully!"
374+
echo "πŸ“Š **Service URL**: [$SERVICE_URL]($SERVICE_URL)"
375+
echo "πŸ”„ **Rolled Back To**: \`$ROLLBACK_REVISION\`"
376+
echo "πŸ“ˆ **Traffic Restored**: ${{ steps.current-status.outputs.current_canary_traffic }}% canary β†’ 100% stable"
377+
echo "🧹 **Cleanup**: $([ \"${{ inputs.cleanup_canary_revision }}\" = \"true\" ] && echo \"Enabled\" || echo \"Disabled\")"
378+
echo ""
379+
echo "### πŸ“Š Final Traffic Allocation"
380+
echo "\`\`\`"
381+
echo "$TRAFFIC_OUTPUT"
382+
echo "\`\`\`"
383+
echo ""
384+
echo "### πŸ” Next Steps"
385+
echo "1. **Investigate** the issues that caused the rollback"
386+
echo "2. **Fix** the problems in your code"
387+
echo "3. **Test** thoroughly before next deployment"
388+
echo "4. **Deploy** a new version when ready"
389+
echo ""
390+
echo "### βœ… Rollback Results"
391+
echo "- 🚨 All traffic restored to **stable revision**"
392+
echo "- 🏷️ Service tagged as **stable** and ready for future deployments"
393+
echo "- 🧹 Canary revision cleaned up (if enabled)"
394+
echo ""
395+
echo "⚠️ **Important**: Review logs and monitoring data to understand what went wrong."
396+
} >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
Β (0)