Skip to content

Commit 7e4754c

Browse files
committed
fix(showcase): skip redeploy-staging when no build succeeded; alert #oss-alerts
redeploy-staging now also gates on aggregate-build-results.outputs.any_success == 'true'. When every slot fails, the previous behavior silently kicked a redeploy that just re-pulled the stale :latest and reported healthy. With this gate, the redeploy is suppressed and a sibling notify-all-builds-failed job marks the workflow red and posts to #oss-alerts so the all-broken state cannot hide behind a green run. The new notify-all-builds-failed job is distinct from the existing notify: job (which fires on any build-slot failure); both can fire and that overlap is intentional, per the Slack alert SOP. [BLITZ:L3-wf] E-5c wiring.
1 parent 16790be commit 7e4754c

1 file changed

Lines changed: 48 additions & 12 deletions

File tree

.github/workflows/showcase_build.yml

Lines changed: 48 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -513,19 +513,24 @@ jobs:
513513

514514
redeploy-staging:
515515
name: Trigger Railway staging redeploy
516-
needs: [detect-changes, build]
516+
needs: [detect-changes, build, aggregate-build-results]
517517
# Run if at least one service was in the matrix AND the build job
518-
# was not outright cancelled or skipped. We tolerate per-slot build
519-
# failures: redeploy what we did push (the script only redeploys
520-
# requested services, and slots that failed to push will simply
521-
# re-pull the previous :latest — which is a no-op). However, if the
522-
# build job was SKIPPED entirely (e.g. the verify-image-refs prod
523-
# digest-pin gate failed, blocking build), suppress the redeploy:
524-
# nothing was pushed and there is no reason to redeploy staging.
525-
# Partial build failures (fail-fast: false) still surface as
526-
# needs.build.result == 'failure', so the intent of redeploying what
527-
# did get pushed is preserved.
528-
if: ${{ !cancelled() && needs.detect-changes.outputs.has_changes == 'true' && needs.build.result != 'skipped' && needs.build.result != 'cancelled' }}
518+
# was not outright cancelled or skipped AND at least one slot
519+
# succeeded (per aggregate-build-results.outputs.any_success). The
520+
# any_success guard is the explicit "do not redeploy when nothing
521+
# was pushed" check — without it, an all-failed build run would
522+
# still kick a redeploy that just re-pulls the stale :latest and
523+
# silently looks healthy. The skipped/cancelled checks on the build
524+
# job still cover the "verify-image-refs gate blocked the build job
525+
# entirely" path. Partial build failures (fail-fast: false) still
526+
# surface as needs.build.result == 'failure' with any_success ==
527+
# 'true', so redeploying what did get pushed is preserved.
528+
if: >-
529+
${{ !cancelled()
530+
&& needs.detect-changes.outputs.has_changes == 'true'
531+
&& needs.build.result != 'skipped'
532+
&& needs.build.result != 'cancelled'
533+
&& needs.aggregate-build-results.outputs.any_success == 'true' }}
529534
runs-on: ubuntu-latest
530535
timeout-minutes: 5
531536
permissions:
@@ -566,6 +571,37 @@ jobs:
566571
# verify-deploy workflow is the real release gate.
567572
npx tsx showcase/scripts/redeploy-env.ts staging --services "$SERVICES_CSV"
568573
574+
notify-all-builds-failed:
575+
name: Notify all builds failed (staging unchanged)
576+
needs: [detect-changes, build, aggregate-build-results]
577+
# Explicit "everything failed; nothing redeployed" signal — distinct
578+
# from the `notify:` job below which fires on any build-job failure
579+
# (some slots may still have succeeded in that case). Both jobs can
580+
# fire; that's intentional and matches the Slack alert SOP.
581+
if: >-
582+
${{ !cancelled()
583+
&& needs.detect-changes.outputs.has_changes == 'true'
584+
&& needs.aggregate-build-results.outputs.any_success == 'false' }}
585+
runs-on: ubuntu-latest
586+
timeout-minutes: 3
587+
permissions:
588+
contents: read
589+
env:
590+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_OSS_ALERTS }}
591+
steps:
592+
- name: Mark workflow red (no service succeeded)
593+
run: |
594+
echo "::error::All builds failed for this run; staging redeploy skipped; :latest unchanged."
595+
exit 1
596+
- name: Slack #oss-alerts
597+
if: always() && env.SLACK_WEBHOOK != ''
598+
uses: slackapi/slack-github-action@b0fa283ad8fea605de13dc3f449259339835fc52 # v2.1.0
599+
with:
600+
webhook: ${{ secrets.SLACK_WEBHOOK_OSS_ALERTS }}
601+
webhook-type: incoming-webhook
602+
payload: |
603+
{ "text": ${{ toJSON(format(':x: *Showcase: all builds failed*\nstaging unchanged (no redeploy)\nCommit: `{0}` by {1}\n<https://github.com/{2}/actions/runs/{3}|View run>', github.sha, github.actor, github.repository, github.run_id)) }} }
604+
569605
notify:
570606
name: Notify on failure
571607
needs: [build]

0 commit comments

Comments
 (0)