Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8392ce3d4b | ||
|
|
844c5ff453 | ||
|
|
7e920c01da | ||
|
|
5d8a86d96b | ||
|
|
03561bc677 | ||
|
|
19f0329d62 |
@@ -39,6 +39,18 @@ keeps every weekly edition looking the same regardless of which model writes the
|
||||
- **Security analysis.** Scan the per-recipe `upgrade_notes_md` + the summary (and use your own
|
||||
knowledge of the version bumps) for upgrades that fix **CVEs / security issues**. For each recipe,
|
||||
**count the CVEs** the PR fixes — this drives both the table's `cve` column and the priority sort.
|
||||
Before crediting a CVE to an open PR, compare that PR's head `compose.yml` with the **current
|
||||
target-branch tip**, both pinned by SHA at report time. Run
|
||||
`advisory-scan.py <recipe> --compose-from <current-target-sha-raw-url>
|
||||
--compose-to <head-sha-raw-url>` when an upgrade log lacks that exact scan, or when its listed
|
||||
image windows disagree with the PR diff. Credit image CVEs only for image version changes in
|
||||
that diff, and only if the PR head is the fixed version. An upgrade-time merge base may now be
|
||||
stale if upstream advanced; a previous release or warm canonical can also include fixes already
|
||||
present in the target branch. For example, lasuite-docs PR #11 did not change Valkey,
|
||||
so its 8.1.11→9.1.3 CVE must not be credited to that PR. Record a security-relevant config
|
||||
fix separately with direct evidence that the target branch lacks it. If the current diff cannot
|
||||
be verified, use `?` and explain why. If the PR head is behind the target branch or unmergeable,
|
||||
say so in the same row; its old CI result is not proof that the current combined recipe works.
|
||||
- **ADDITIONALLY, and never instead:** each per-recipe log carries an `### Advisory scan
|
||||
(deterministic pre-step)` block (from `cc-ci-plan/advisory-scan.py` — GitHub Security
|
||||
Advisories + vendor security pages + OSV, with severities and fixed-in versions). Treat its
|
||||
@@ -48,10 +60,13 @@ keeps every weekly edition looking the same regardless of which model writes the
|
||||
lists **failed sources**, the count is **not** authoritative: render the cve cell as `?`
|
||||
(unknown), never `none` — a blank that reads as "clean" is exactly how two CVSS-9.8 gitea
|
||||
RCEs were reported as "none" on 2026-08-07.
|
||||
- The table's **CVEs** column counts known CVEs addressed by the available recipe upgrade.
|
||||
A zero for an up-to-date recipe means there is no upgrade window to credit; it does not
|
||||
certify that the running images are free of vulnerabilities. If an upgrade exists but its
|
||||
advisory scan is absent, a source failed, or an image window was unmatched, use `?`.
|
||||
- The table's **CVEs** column counts known CVEs fixed by the **current open PR's diff against
|
||||
current target branch**, even if `/upgrade-all` found no new image version this week. Keep the
|
||||
existing one-row-per-recipe table and show that PR in the row. `SKIPPED — up-to-date` describes
|
||||
this week's image survey, not the absence of a relevant open PR; use the PR's actual CI verdict
|
||||
in TESTS when one exists. A zero means the current PR fixes no verified CVEs (or there is no
|
||||
PR); it does not certify that deployed images are vulnerability-free. If the PR's advisory
|
||||
scan is absent, a source failed, or an image window was unmatched, use `?`.
|
||||
If a confirmed security advisory is fixed but has no CVE ID, put `"YES"` in `cve` rather
|
||||
than `0`; describe its advisory ID and severity in Notes. If CVE IDs are also fixed, show
|
||||
the numeric CVE count and mention the additional non-CVE advisories in Notes.
|
||||
@@ -70,8 +85,10 @@ keeps every weekly edition looking the same regardless of which model writes the
|
||||
When a sidecar contributes a critical/high, name the image in the bulletin — CVE-2025-49844 is
|
||||
a redis flaw, not a discourse one, and an operator reading "discourse" needs to know that.
|
||||
(The scan headline itself now says `UNKNOWN` rather than a number in that case.)
|
||||
In particular: a recipe with **no upgrade this run** (up-to-date/skipped) has nothing an
|
||||
upgrade could have fixed — report `0`, not `?`. A recipe with a clean scan reports its number (including `0`). Benign notes in a scan
|
||||
In particular: **no new image upgrade this run does not force `0`** if an open PR still has
|
||||
an unmerged security change. Recheck its current diff and credit only fixes absent from the
|
||||
current target branch. A recipe with no relevant PR reports `0`; a clean PR scan reports its
|
||||
number (including `0`). Benign notes in a scan
|
||||
block (`no-advisories-published`, `skipped: template URL`) are NOT failures and must not
|
||||
trigger `?`. If you find yourself rendering `?` for many recipes, that is a bug to report in
|
||||
the Addendum, not a normal outcome.
|
||||
@@ -91,9 +108,9 @@ keeps every weekly edition looking the same regardless of which model writes the
|
||||
re-runs), drift between the summary and reality, a **misleading branch name**, a tooling snag that
|
||||
silently drops a recipe, leftover artifact PRs, or **something in the test run that could be
|
||||
improved**. **Only real issues — if everything looks clean, leave it empty; do NOT invent items.**
|
||||
- **What changed — per recipe with a PR.** One short section per recipe that has a PR this week
|
||||
describing what the upgrade actually changes (versions, notable deps, migrations/gotchas, reconcile
|
||||
notes). Skip recipes with no PR.
|
||||
- **What changed — per recipe with a relevant open PR.** Describe the PR's current diff (versions,
|
||||
configuration, migrations/gotchas, reconcile notes), including an older PR still awaiting merge.
|
||||
Say when it was last updated and whether it can merge cleanly. Skip recipes with no relevant PR.
|
||||
|
||||
4. **Write the spec** `/tmp/report-spec.json` (shape in the helper header):
|
||||
- `date`, `subtitle` ("Week of <human date>"),
|
||||
|
||||
@@ -101,7 +101,12 @@ the real current recipe, not a stale mirror.
|
||||
3. If any has a newer supported upstream tag than what's pinned → there **is** an upgrade: proceed to
|
||||
plan/implement it (per §2, preserving any digest pin).
|
||||
- **Conclude `SKIPPED — up-to-date` only when** abra found no bump for the images it could read **and**
|
||||
the direct check finds nothing newer for the abra-unparseable images. If every image had a normal tag
|
||||
the direct check finds nothing newer for the abra-unparseable images **and no open PR still needs
|
||||
review**. Inspect open recipe PRs even when image tags are current. If a PR's useful change is
|
||||
already in current upstream, obsolete, or superseded, close it with a specific explanatory comment.
|
||||
If it is still useful, replay that change on current upstream, preserving the latest image tags and
|
||||
required configuration, then update and retest the same PR. A former GREEN result on an old head
|
||||
does not validate the rebased recipe. If every image had a normal tag
|
||||
abra could read, abra's verdict stands alone — no upstream check needed. A `tag and digest … not
|
||||
supported` FATA is a **trigger for the upstream check on that image, never a skip on its own.**
|
||||
- Check `git log HEAD..origin/main` and upstream PRs (`git.coopcloud.tech/coop-cloud/<recipe>/pulls`)
|
||||
@@ -159,26 +164,21 @@ On cc-ci's `~/.abra/recipes/<recipe>` (wrap every abra call per the pseudo-TTY b
|
||||
|
||||
### 2a. Advisory scan (deterministic; ADDITIVE — run it, never skip it)
|
||||
|
||||
Run the deterministic scanner for the exact upgrade window and **paste its markdown block verbatim
|
||||
into the per-recipe log**:
|
||||
Run the deterministic scanner against the **exact proposed PR diff** and paste its markdown block
|
||||
verbatim into the per-recipe log. Use the proposed head's `compose.yml` and the commit it branches
|
||||
from (the merge base with the target branch), both pinned by commit SHA:
|
||||
|
||||
```
|
||||
python3 /srv/cc-ci/cc-ci-plan/advisory-scan.py <recipe> --from <old-app-version> --to <new-app-version> \
|
||||
[--image <name>=<old>:<new>]...
|
||||
python3 /srv/cc-ci/cc-ci-plan/advisory-scan.py <recipe> \
|
||||
--compose-from <raw-compose-url-at-pr-base-sha> \
|
||||
--compose-to <raw-compose-url-at-pr-head-sha>
|
||||
```
|
||||
|
||||
**Pass an `--image` for EVERY sidecar you upgraded** (redis, postgres, nginx …), not just the app —
|
||||
each image is judged by its own versions, and an image you don't name is not counted at all. Repeat
|
||||
the flag for each one and pass them **all in a single call** (the count is a union across images).
|
||||
e.g. discourse moving app 3.5.3→2026.7.1 *and* redis 7.4→8.10:
|
||||
|
||||
```
|
||||
... --from 3.5.3 --to 2026.7.1 --image redis=7.4:8.10
|
||||
```
|
||||
|
||||
→ 140 CVEs (123 app + 17 redis), where the redis seventeen include a **critical** (CVE-2025-49844)
|
||||
that is invisible if the sidecar is left out. `<name>` is substring-matched against source repo names,
|
||||
so make it specific enough to hit exactly one.
|
||||
Do not substitute the previous published release, warm canonical, or a hand-typed image window for
|
||||
the PR base. Those answer a different question and can credit a PR for CVEs fixed before its branch
|
||||
was created. The compose diff includes every changed image, including sidecars. If the PR changes no
|
||||
image tags, record zero image-version CVEs for this PR; assess any security-relevant configuration
|
||||
change separately, with its own evidence.
|
||||
|
||||
**If the scan reports advisories it could NOT judge, re-run it with `--adjudicate`.** That is a second
|
||||
pass: it collects each open case's full evidence (advisory prose, references, affected ranges, every
|
||||
@@ -281,6 +281,13 @@ only. The body must **also** carry the recommended release command — `abra rec
|
||||
final publish step (bumps the label + tags + pushes) after the upstream PR merges. Re-running with the
|
||||
same target version updates the existing same-branch PR rather than duplicating it.
|
||||
|
||||
For a useful open PR whose branch is not `upgrade-*`, set `RECIPE_PR_NUMBER=<number>` for
|
||||
`open-recipe-pr.sh` after replaying its change onto current upstream. The helper then rewrites that
|
||||
specific PR branch using `--force-with-lease`; never select an unrelated PR by inference. If several
|
||||
open PRs have useful compatible changes for the same recipe, combine them only after reviewing each
|
||||
diff and close the superseded PRs with links to the surviving PR. If a change cannot be made
|
||||
mergeable and verified, leave the PR clearly marked unresolved rather than reporting it as ready.
|
||||
|
||||
### 4. VERIFY by running `!testme` ON THE PR (results visible in the PR; iterate ≤3×)
|
||||
Trigger the **real** CI on the recipe PR by posting `!testme` — the bridge runs the harness on cc-ci
|
||||
and posts the run + its results back to the PR, so the operator sees them in the PR. Use the PR index
|
||||
@@ -362,8 +369,8 @@ Always state explicitly that **nothing was merged** — the PR(s) await operator
|
||||
them to turn a `dev-` deploy or `!testme` green. In DEFAULT mode, fix the recipe or leave a PR comment
|
||||
— never touch the gate. (Interim safeguard while the upgrader runs on the cc-ci host; see `IDEAS.md`.)
|
||||
- **Mirror reflects reality.** Each run force-syncs the `recipe-maintainers/<recipe>` mirror `main` to
|
||||
true upstream main and closes open PRs already merged upstream. It does NOT close superseded/unrelated
|
||||
open PRs. **An existing open upgrade PR is rewritten with one commit on the current upstream tip
|
||||
true upstream main and closes open PRs already merged upstream. The weekly review also closes stale
|
||||
PRs with no remaining value after checking their diff. **An existing useful PR is rewritten with one commit on the current upstream tip
|
||||
using `--force-with-lease`, then re-tested** — one evolving upgrade PR per recipe.
|
||||
- **Prefer a recipe-only PR.** Only open a cc-ci test PR (under `--with-tests`) when the upgrade is
|
||||
correct but a test is genuinely stale — never to paper over a real upgrade regression.
|
||||
|
||||
@@ -145,6 +145,8 @@ echo "→ Reconciling open PRs on ${NAMESPACE}/${RECIPE}..."
|
||||
OPEN_PRS=$(curl -s "${AUTH[@]}" "${API}/repos/${NAMESPACE}/${RECIPE}/pulls?state=open&base=main&limit=50")
|
||||
# Close merged-upstream PRs (no-op merges); leave everything else open. Also pick an existing open
|
||||
# UPGRADE PR (branch 'upgrade-*' — this tool's convention) to EXTEND, if one exists.
|
||||
# RECIPE_PR_NUMBER explicitly selects another existing PR (for example a security fix) after the
|
||||
# caller has reviewed and carried its useful diff onto current main.
|
||||
EXTEND_PR=""; EXTEND_BRANCH=""
|
||||
while IFS=$'\t' read -r IDX HEAD_REF; do
|
||||
[ -n "${IDX:-}" ] || continue
|
||||
@@ -153,11 +155,18 @@ while IFS=$'\t' read -r IDX HEAD_REF; do
|
||||
continue
|
||||
fi
|
||||
echo " • PR #${IDX} (${HEAD_REF}) still open vs upstream main — leaving open"
|
||||
if [ "${MODE}" != "--reconcile-only" ] && [ -z "${EXTEND_PR}" ] && printf '%s' "${HEAD_REF}" | grep -q '^upgrade-'; then
|
||||
if [ "${MODE}" != "--reconcile-only" ] && [ -n "${RECIPE_PR_NUMBER:-}" ] && [ "${IDX}" = "${RECIPE_PR_NUMBER}" ]; then
|
||||
EXTEND_PR="${IDX}"; EXTEND_BRANCH="${HEAD_REF}"
|
||||
elif [ "${MODE}" != "--reconcile-only" ] && [ -z "${RECIPE_PR_NUMBER:-}" ] && [ -z "${EXTEND_PR}" ] && printf '%s' "${HEAD_REF}" | grep -q '^upgrade-'; then
|
||||
EXTEND_PR="${IDX}"; EXTEND_BRANCH="${HEAD_REF}"
|
||||
fi
|
||||
done < <(echo "${OPEN_PRS}" | jq -r '.[] | [(.number | tostring), .head.ref] | @tsv' 2>/dev/null || true)
|
||||
|
||||
if [ "${MODE}" != "--reconcile-only" ] && [ -n "${RECIPE_PR_NUMBER:-}" ] && [ "${EXTEND_PR}" != "${RECIPE_PR_NUMBER}" ]; then
|
||||
echo "ERROR: selected PR #${RECIPE_PR_NUMBER} is not an open PR against current main" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "${MODE}" = "--reconcile-only" ]; then
|
||||
echo "✓ reconcile-only done for ${NAMESPACE}/${RECIPE} (main synced; merged-upstream PRs closed)."
|
||||
exit 0
|
||||
|
||||
@@ -153,9 +153,18 @@ resolver finds the newer image. A warning is never evidence that an image is cur
|
||||
`newest_same_shape` and `newest_within_major`; a newer major is still a candidate for planning,
|
||||
though it must not be applied without a compatibility check.
|
||||
|
||||
Build `RECIPES_TO_UPGRADE` from every recipe with at least one candidate. Only label a recipe
|
||||
Build `RECIPES_TO_UPGRADE` from every recipe with at least one candidate **or an open recipe PR
|
||||
that still differs from current upstream**. The second case is a PR reconciliation candidate even
|
||||
when all image tags are current: review whether its change still adds value. If the change is
|
||||
already present, obsolete, or superseded, close the stale PR with a concrete reason. If it remains
|
||||
useful, carry its change onto current upstream, update the **same PR**, and run fresh `!testme`.
|
||||
Do not call it GREEN based on CI for an old head, or leave an unmergeable PR as the week's proposed
|
||||
fix. Count its CVEs only from the useful change still absent from current upstream.
|
||||
|
||||
Only label a recipe
|
||||
`up-to-date` if abra completed successfully **and** the resolver checked every relevant image
|
||||
(`all_resolved: true`) **and** neither found a candidate. If an image is unresolved, templated,
|
||||
(`all_resolved: true`) **and** neither found a candidate **and no open PR needs reconciliation**.
|
||||
If an image is unresolved, templated,
|
||||
floating, or lacks comparable tags, investigate it directly and record the evidence. Otherwise
|
||||
record `unverified` with the image and reason; never fold it into `up-to-date`. `dirty-worktree`
|
||||
applies only to real tracked edits. A tag+digest parse failure is not `not-fetchable`.
|
||||
@@ -205,6 +214,10 @@ description `"Upgrade <recipe> on cc-ci"`) with a prompt like:
|
||||
> upstream. Do NOT merge. Print exactly one `RESULT:` line as your final line (SUCCESS /
|
||||
> SUCCESS-PENDING-TESTS / FAILED / SKIPPED — `SUCCESS+TESTPR` will not occur in default mode).
|
||||
|
||||
For a recipe selected solely because it has an open PR, tell the worker which PR number to review.
|
||||
The worker may close it if no useful change remains; otherwise it must update that PR rather than
|
||||
opening another. A closure is a completed reconciliation, not an upgrade success.
|
||||
|
||||
**Why default (no `--with-tests`):** the weekly cron must never auto-edit cc-ci tests unattended — a
|
||||
test change deserves a human decision. So the cron opens recipe PRs only; where a recipe's existing
|
||||
test looks stale, the operator sees the explanation in the PR comment and can re-run that one recipe
|
||||
|
||||
@@ -56,6 +56,11 @@ advisory-scan.py <recipe> --compose-to <URL> [--compose-from <URL>] # windows
|
||||
|
||||
Exit code is always 0 — this is informational. Failures are *reported*, never raised.
|
||||
|
||||
For PR attribution, pin both compose URLs to commits: the PR head and its merge base with the
|
||||
target branch. A previous release or warm canonical can include image changes already present
|
||||
before the PR. A compose diff with only sidecar changes has no primary app window; every changed
|
||||
sidecar is scanned under its own image name.
|
||||
|
||||
---
|
||||
|
||||
# Pass 1 — deterministic
|
||||
|
||||
@@ -1336,7 +1336,8 @@ def _default_branch_compose(url: str) -> str | None:
|
||||
return f"{host}/{owner}/{repo}/raw/branch/{br}/{path}" if br else None
|
||||
|
||||
|
||||
def windows_from_compose(to_url: str, from_url: str | None = None) -> tuple[list, str | None]:
|
||||
def windows_from_compose(to_url: str, from_url: str | None = None,
|
||||
include_primary: bool = False) -> tuple:
|
||||
"""Derive the scan's version windows by DIFFING two compose files.
|
||||
|
||||
This is the deterministic alternative to a human (or a model) deciding which `--image` args a
|
||||
@@ -1366,7 +1367,8 @@ def windows_from_compose(to_url: str, from_url: str | None = None) -> tuple[list
|
||||
else:
|
||||
others.append((repo.split("/")[-1], prev_tag, tag))
|
||||
wins = ([app] if app else []) + others
|
||||
return wins, f"baseline {from_url}"
|
||||
result = (wins, f"baseline {from_url}")
|
||||
return (*result, bool(app)) if include_primary else result
|
||||
|
||||
|
||||
def main() -> int:
|
||||
@@ -1395,7 +1397,8 @@ def main() -> int:
|
||||
a = ap.parse_args()
|
||||
images = []
|
||||
if a.compose_to:
|
||||
wins, note = windows_from_compose(a.compose_to, a.compose_from)
|
||||
wins, note, app_changed = windows_from_compose(a.compose_to, a.compose_from,
|
||||
include_primary=True)
|
||||
if not wins:
|
||||
print(f"### Advisory scan — {a.recipe}\n\n**No image versions changed between the two "
|
||||
f"compose files, so this upgrade fixes no CVEs by definition.**\n\n_{note}_")
|
||||
@@ -1403,11 +1406,13 @@ def main() -> int:
|
||||
print(f"_derived from compose diff ({note}):_", file=sys.stderr)
|
||||
for n_, f_, t_ in wins:
|
||||
print(f"_ {n_}: {f_} → {t_}_", file=sys.stderr)
|
||||
# The `app` service (first entry when present) drives --from/--to; the rest are --image
|
||||
# windows. Passing every window as --image too is harmless: each is matched by name against
|
||||
# the advisory sources, and an unmatched name is simply ignored.
|
||||
a.v_from, a.v_to = a.v_from or wins[0][1], a.v_to or wins[0][2]
|
||||
images = list(wins[1:])
|
||||
# Only an actual app-service change defines the primary window. A sidecar-only PR must
|
||||
# not be scanned as though its first sidecar were the application image.
|
||||
if app_changed:
|
||||
a.v_from, a.v_to = a.v_from or wins[0][1], a.v_to or wins[0][2]
|
||||
images = list(wins[1:])
|
||||
else:
|
||||
images = list(wins)
|
||||
for spec in a.image:
|
||||
name, _, rng = spec.partition('=')
|
||||
vf, _, vt = rng.partition(':')
|
||||
|
||||
@@ -100,7 +100,11 @@ def survey(date):
|
||||
if s.get("context") == "cc-ci/testme":
|
||||
ci = {"state": s.get("state"), "url": s.get("target_url"), "desc": s.get("description")}
|
||||
rec["open_prs"].append({"number": p["number"], "title": p["title"],
|
||||
"url": p["html_url"], "head": sha[:10], "ci": ci})
|
||||
"url": p["html_url"], "head": sha,
|
||||
"base": p.get("base", {}).get("sha"),
|
||||
"created_at": p.get("created_at"),
|
||||
"updated_at": p.get("updated_at"),
|
||||
"mergeable": p.get("mergeable"), "ci": ci})
|
||||
# Per-recipe upgrade plan/summary (has the breaking-change + CVE/security analysis) — the agent
|
||||
# mines this to lead with critical-CVE upgrades.
|
||||
nf = os.path.join(LOGDIR, "upgrades", f"{r}-upgrade-{date}.md")
|
||||
|
||||
@@ -746,6 +746,41 @@ volumes:
|
||||
def test_no_change_yields_no_windows(self):
|
||||
self.assertEqual(self._windows(old=self.NEW, new=self.NEW), [])
|
||||
|
||||
def test_lasuite_docs_pr_does_not_claim_preexisting_valkey_upgrade(self):
|
||||
base = """services:
|
||||
app:
|
||||
image: lasuite/impress-frontend:v6.0.4
|
||||
yhub-valkey:
|
||||
image: valkey/valkey:9.1.3-alpine
|
||||
docspec:
|
||||
image: ghcr.io/docspecio/api:3.0.2
|
||||
"""
|
||||
head = base.replace("ghcr.io/docspecio/api:3.0.2", "ghcr.io/docspec/api:1.21.4")
|
||||
windows = self._windows(old=base, new=head)
|
||||
self.assertEqual(windows, [("api", "3.0.2", "1.21.4")])
|
||||
self.assertNotIn("valkey", [name for name, _, _ in windows])
|
||||
|
||||
captured = {}
|
||||
|
||||
def fake_scan(recipe, v_from, v_to, registry, images):
|
||||
captured.update(from_version=v_from, to_version=v_to, images=images)
|
||||
return {"recipe": recipe, "from": v_from, "to": v_to,
|
||||
"count_known": True, "cve_count_fixed": 0, "cves": {}, "sources": [],
|
||||
"fixed_by_this_upgrade": [], "unclassified": [], "registry_urls": 0,
|
||||
"sources_failed": [], "sources_benign": [], "windows": {},
|
||||
"classified_by": {}}
|
||||
|
||||
with unittest.mock.patch.object(A, "windows_from_compose",
|
||||
return_value=(windows, "pinned base", False)), \
|
||||
unittest.mock.patch.object(A, "scan", fake_scan), \
|
||||
unittest.mock.patch.object(sys, "argv", ["advisory-scan.py", "lasuite-docs",
|
||||
"--compose-from", "base", "--compose-to", "head"]), \
|
||||
unittest.mock.patch.object(sys, "stdout", io.StringIO()), \
|
||||
unittest.mock.patch.object(sys, "stderr", io.StringIO()):
|
||||
A.main()
|
||||
self.assertIsNone(captured["from_version"])
|
||||
self.assertEqual(captured["images"], windows)
|
||||
|
||||
def test_templated_tags_are_skipped(self):
|
||||
new = self.NEW.replace('ghcr.io/plausible/community-edition:v3.2.1', 'ghost:${IMAGE_VERSION}')
|
||||
self.assertNotIn("ghost", [n for n, _, _ in self._windows(new=new)])
|
||||
|
||||
Reference in New Issue
Block a user