Skip to content

Commit 14acbba

Browse files
committed
ci: add dependency-review-gate aggregator check
The Socket Firewall enterprise smoke job is the most meaningful supply-chain check for maintainer-added dependencies, but it can't be required directly: it's conditional (per-manifest, and free-vs-enterprise per author), so on most PRs it's legitimately skipped -- and a required check whose job is skipped sits at "Expected -- Waiting for status" forever, blocking merge (the same trap that stranded Dependabot PRs on the e2e-* checks). Add a dependency-review-gate job that always runs and collapses every smoke job into one pass/fail signal: it fails iff any job that ran ended in failure or was cancelled; success and skipped both pass. This is the single check intended to be marked required later -- it satisfies Dependabot/fork PRs (which run Firewall-free) and maintainer PRs (Firewall-enterprise) alike, and turns a Socket Firewall BLOCK into a merge-blocking failure instead of a non-required job nobody is forced to run. Scaffolding only: the gate is not yet added to branch protection's required checks (deferred until it's merged to main and observed reporting). Signed-off-by: lelia <2418071+lelia@users.noreply.github.com>
1 parent 3c991e3 commit 14acbba

1 file changed

Lines changed: 65 additions & 0 deletions

File tree

.github/workflows/dependency-review.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,3 +586,68 @@ jobs:
586586
echo "This PR changes workflow, composite-action, or dependabot config files."
587587
echo "Require explicit human review before merge."
588588
} >> "$GITHUB_STEP_SUMMARY"
589+
590+
# Single required status check that aggregates the conditional smoke jobs
591+
# above. Branch protection can't require those jobs individually: each is
592+
# conditional (per-manifest, and Firewall-free vs -enterprise per author), so
593+
# on any given PR most are legitimately skipped -- and a required check whose
594+
# job is skipped sits at "Expected -- Waiting for status to be reported"
595+
# forever, blocking merge (the same trap that stranded Dependabot PRs on the
596+
# e2e-* checks).
597+
#
598+
# This gate always runs (if: always(), so it reports even when upstream jobs
599+
# are skipped or fail) and collapses them into one pass/fail signal: it FAILS
600+
# if any smoke job that ran ended in failure or was cancelled, and passes when
601+
# everything either succeeded or was not applicable. 'skipped' is expected and
602+
# allowed -- it just means the job didn't apply to this PR.
603+
#
604+
# Mark THIS check (dependency-review-gate) required in branch protection. It
605+
# satisfies Dependabot/fork PRs (which run the Firewall-free job) and
606+
# maintainer PRs (which run Firewall-enterprise) alike, and -- crucially -- a
607+
# Socket Firewall BLOCK now fails the gate and blocks merge, instead of living
608+
# in a non-required enterprise job that nobody is forced to run.
609+
dependency-review-gate:
610+
needs:
611+
- inspect
612+
- python-sfw-smoke-free
613+
- python-sfw-smoke-enterprise
614+
- fixture-npm-sfw-smoke-free
615+
- fixture-npm-sfw-smoke-enterprise
616+
- fixture-pypi-sfw-smoke-free
617+
- fixture-pypi-sfw-smoke-enterprise
618+
- dockerfile-smoke
619+
if: always()
620+
runs-on: ubuntu-latest
621+
timeout-minutes: 2
622+
steps:
623+
- name: Verify no smoke job failed
624+
env:
625+
RESULTS: ${{ toJSON(needs) }}
626+
run: |
627+
echo "Upstream job results:"
628+
printf '%s\n' "$RESULTS" | python3 -m json.tool
629+
630+
# Fail the gate if any needed job ended in failure or was cancelled.
631+
# 'success' and 'skipped' both pass: skipped means the job did not
632+
# apply to this PR (wrong manifest, or free-vs-enterprise mismatch).
633+
failed="$(printf '%s\n' "$RESULTS" | python3 -c "
634+
import json, sys
635+
data = json.load(sys.stdin)
636+
bad = [name for name, info in data.items()
637+
if info.get('result') in ('failure', 'cancelled')]
638+
print(' '.join(sorted(bad)))
639+
")"
640+
641+
if [ -n "$failed" ]; then
642+
echo "::error::dependency-review smoke job(s) failed: $failed"
643+
{
644+
echo "## Dependency Review Gate: FAILED"
645+
echo "The following smoke job(s) failed or were cancelled: \`$failed\`"
646+
echo "If a Socket Firewall job is listed, it likely BLOCKED an install --"
647+
echo "inspect its uploaded sfw-artifacts/ report before merging."
648+
} >> "$GITHUB_STEP_SUMMARY"
649+
exit 1
650+
fi
651+
652+
echo "All dependency-review smoke jobs passed or were not applicable."
653+
echo "## Dependency Review Gate: PASSED" >> "$GITHUB_STEP_SUMMARY"

0 commit comments

Comments
 (0)