Skip to content

armgit / AiSOC

Public Imported from GitHub
0

Open-source AI Security Operations Center: alert fusion, LLM-agent triage, MITRE ATT&CK investigation, and a replayable decision ledger for every agent step. Self-hostable, runs with no API keys, MIT licensed. Ships an MCP server for Claude, Cursor and Continue.

fix(ci): a dispatched release that publishes nothing must not report success (#891)

Beenu Arora19971b594d96
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 69fe891e6..733bce225 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -400,6 +400,14 @@ jobs:
name: Docker — Publish (${{ matrix.service }})
runs-on: ubuntu-24.04
needs: docker-build
+ # A skip propagates the whole way down a `needs` chain, not just one link:
+ # `docker-build` overrode it with `always()`, and this job — which has no
+ # condition of its own — was skipped anyway because `release` was. The
+ # dispatched run then reported **success** having built both architectures
+ # of sixteen images and published none of them, which is the same silent
+ # green this workflow was being fixed for. Every job below the conditional
+ # one has to say `always()` and then state what it actually requires.
+ if: always() && needs.docker-build.result == 'success'
timeout-minutes: 15
strategy:
fail-fast: false
@@ -716,6 +724,7 @@ jobs:
name: Docker — Released images match the tree
runs-on: ubuntu-24.04
needs: docker-manifest
+ if: always() && needs.docker-manifest.result == 'success'
timeout-minutes: 10
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8580c3d3e..4b453189b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -117,6 +117,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
an existing tag, because the only way to finish a half-published release was
previously to invent a new tag for a commit that had already shipped.
+- **A dispatched release reported success having published nothing.** The
+ recovery path's `release` job is push-only, and a skip propagates the whole
+ length of a `needs` chain rather than one link: `docker-build` declared
+ `always()` and ran, `docker-manifest` declared nothing and was skipped
+ anyway. The first dispatched run built both architectures of sixteen images,
+ tagged none of them, and went green — the same silent green the workflow was
+ being changed to fix. Every job below the conditional one now says
+ `always()` and states what it requires, and
+ `test_no_job_below_a_conditional_one_is_silently_skipped` walks the `needs`
+ graph of both workflows so the shape cannot return.
+
- **The console's manifest job collected the demo build's digests as well as
its own.** `web` and `web-demo` push to the same repository and the digest
artefacts were keyed `digest-<service>-<platform>`, downloaded with a
diff --git a/tests/test_first_run_gate.py b/tests/test_first_run_gate.py
index 1d87bfc4c..d6463eb24 100644
--- a/tests/test_first_run_gate.py
+++ b/tests/test_first_run_gate.py
@@ -254,6 +254,57 @@ def test_one_image_cannot_collect_another_images_digests(workflow: pathlib.Path)
)
+#: Expressions that make a job run despite an upstream skip. Without one of
+#: these, GitHub's default `success()` condition skips the job — and it
+#: propagates the whole length of a `needs` chain rather than one link.
+_SURVIVES_A_SKIP = ("always()", "!cancelled()")
+
+
+ "workflow",
+ [PUBLISH_WORKFLOW, RELEASE_WORKFLOW],
+ ids=["publish-images", "release"],
+)
+def test_no_job_below_a_conditional_one_is_silently_skipped(workflow: pathlib.Path) -> None:
+ """A run that publishes nothing must not report success.
+
+ `release.yml` gained a dispatch path whose `release` job is push-only.
+ `docker-build` declared `always()` and ran; `docker-manifest` declared
+ nothing and was skipped anyway, because a skip travels the whole length of
+ a `needs` chain. The dispatched run built both architectures of sixteen
+ images, published none of them, and reported **success** — the same silent
+ green the workflow was being changed to fix.
+
+ So: every job reachable from one that can skip itself must say `always()`
+ (or `!cancelled()`) and then state what it actually requires.
+ """
+ jobs = yaml.safe_load(workflow.read_text())["jobs"]
+
+ def needs_of(name: str) -> list[str]:
+ declared = jobs[name].get("needs") or []
+ return [declared] if isinstance(declared, str) else list(declared)
+
+ def survives(name: str) -> bool:
+ return any(token in str(jobs[name].get("if", "")) for token in _SURVIVES_A_SKIP)
+
+ # A job can skip itself when it carries an `if` that is not one of the
+ # skip-surviving forms — that is the shape that starts the propagation.
+ can_skip = {name for name, job in jobs.items() if job.get("if") and not survives(name)}
+
+ downstream: set[str] = set()
+ frontier = set(can_skip)
+ while frontier:
+ frontier = {name for name in jobs if set(needs_of(name)) & frontier} - downstream - can_skip
+ downstream |= frontier
+
+ offenders = sorted(name for name in downstream if not survives(name))
+ assert not offenders, (
+ f"{workflow.name}: {offenders} sit below a job that can skip itself "
+ f"({sorted(can_skip)}) and do not declare always() or !cancelled(), so a skip "
+ "propagates into them and the run reports success having done nothing."
+ )
+
+
def test_publish_images_keeps_demo_off_the_moving_tags() -> None:
text = PUBLISH_WORKFLOW.read_text()
for tag in ("value=main", "value=latest"):