Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7e920c01da | ||
|
|
5d8a86d96b | ||
|
|
03561bc677 | ||
|
|
19f0329d62 | ||
|
|
22d8ea0ae9 | ||
|
|
e37e10c86b |
@@ -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
|
- **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,
|
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.
|
**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
|
- **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
|
(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
|
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 `?`
|
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
|
(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.
|
RCEs were reported as "none" on 2026-08-07.
|
||||||
- The table's **CVEs** column counts known CVEs addressed by the available recipe upgrade.
|
- The table's **CVEs** column counts known CVEs fixed by the **current open PR's diff against
|
||||||
A zero for an up-to-date recipe means there is no upgrade window to credit; it does not
|
current target branch**, even if `/upgrade-all` found no new image version this week. Keep the
|
||||||
certify that the running images are free of vulnerabilities. If an upgrade exists but its
|
existing one-row-per-recipe table and show that PR in the row. `SKIPPED — up-to-date` describes
|
||||||
advisory scan is absent, a source failed, or an image window was unmatched, use `?`.
|
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
|
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
|
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.
|
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
|
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.
|
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.)
|
(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
|
In particular: **no new image upgrade this run does not force `0`** if an open PR still has
|
||||||
upgrade could have fixed — report `0`, not `?`. A recipe with a clean scan reports its number (including `0`). Benign notes in a scan
|
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
|
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
|
trigger `?`. If you find yourself rendering `?` for many recipes, that is a bug to report in
|
||||||
the Addendum, not a normal outcome.
|
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
|
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
|
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.**
|
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
|
- **What changed — per recipe with a relevant open PR.** Describe the PR's current diff (versions,
|
||||||
describing what the upgrade actually changes (versions, notable deps, migrations/gotchas, reconcile
|
configuration, migrations/gotchas, reconcile notes), including an older PR still awaiting merge.
|
||||||
notes). Skip recipes with no PR.
|
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):
|
4. **Write the spec** `/tmp/report-spec.json` (shape in the helper header):
|
||||||
- `date`, `subtitle` ("Week of <human date>"),
|
- `date`, `subtitle` ("Week of <human date>"),
|
||||||
|
|||||||
@@ -159,26 +159,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)
|
### 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
|
Run the deterministic scanner against the **exact proposed PR diff** and paste its markdown block
|
||||||
into the per-recipe log**:
|
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> \
|
python3 /srv/cc-ci/cc-ci-plan/advisory-scan.py <recipe> \
|
||||||
[--image <name>=<old>:<new>]...
|
--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 —
|
Do not substitute the previous published release, warm canonical, or a hand-typed image window for
|
||||||
each image is judged by its own versions, and an image you don't name is not counted at all. Repeat
|
the PR base. Those answer a different question and can credit a PR for CVEs fixed before its branch
|
||||||
the flag for each one and pass them **all in a single call** (the count is a union across images).
|
was created. The compose diff includes every changed image, including sidecars. If the PR changes no
|
||||||
e.g. discourse moving app 3.5.3→2026.7.1 *and* redis 7.4→8.10:
|
image tags, record zero image-version CVEs for this PR; assess any security-relevant configuration
|
||||||
|
change separately, with its own evidence.
|
||||||
```
|
|
||||||
... --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.
|
|
||||||
|
|
||||||
**If the scan reports advisories it could NOT judge, re-run it with `--adjudicate`.** That is a second
|
**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
|
pass: it collects each open case's full evidence (advisory prose, references, affected ranges, every
|
||||||
@@ -264,11 +259,13 @@ ssh cc-ci "GITEA_USERNAME='$GITEA_USERNAME' GITEA_PASSWORD='$GITEA_PASSWORD' GIT
|
|||||||
```
|
```
|
||||||
This (a) re-syncs mirror `main` to true upstream main, (b) **closes any open PR already merged
|
This (a) re-syncs mirror `main` to true upstream main, (b) **closes any open PR already merged
|
||||||
upstream** (merging it would be a no-op), then handles the upgrade PR: **if an open upgrade PR already
|
upstream** (merging it would be a no-op), then handles the upgrade PR: **if an open upgrade PR already
|
||||||
exists for this recipe (branch `upgrade-*`), the new work is pushed onto THAT PR's branch and the PR is
|
exists for this recipe (branch `upgrade-*`), its branch is replaced with one commit directly on the
|
||||||
updated + re-tested** — one evolving upgrade PR per recipe, not a second parallel one. Only if none
|
current upstream tip using `--force-with-lease`, then the PR is updated + re-tested** — one evolving
|
||||||
|
upgrade PR per recipe with one commit, not a second parallel PR. Only if none
|
||||||
exists is a fresh `upgrade-<version>` PR opened. Unrelated open PRs (e.g. a backup fix) are **NOT**
|
exists is a fresh `upgrade-<version>` PR opened. Unrelated open PRs (e.g. a backup fix) are **NOT**
|
||||||
closed or touched — the operator decides on those. The PR's diff is exactly this upgrade against the
|
closed or touched — the operator decides on those. The PR's diff is exactly this upgrade against the
|
||||||
real current upstream main. Capture the `PR_URL`. Export `RECIPE_PR_BODY` first (image-tag table + the
|
real current upstream main. This squash happens **before `!testme`**, so CI tests the one-commit PR
|
||||||
|
head. Capture the `PR_URL`. Export `RECIPE_PR_BODY` first (image-tag table + the
|
||||||
planned operator-action notes) — and **the PR body MUST link the upstream release notes**: for each
|
planned operator-action notes) — and **the PR body MUST link the upstream release notes**: for each
|
||||||
upgraded image/service, pull its release-notes URL from the registry `cc-ci-plan/upstream/<recipe>.md`
|
upgraded image/service, pull its release-notes URL from the registry `cc-ci-plan/upstream/<recipe>.md`
|
||||||
(between the current → new version) and include one explicit line per service in the body, e.g.
|
(between the current → new version) and include one explicit line per service in the body, e.g.
|
||||||
@@ -297,7 +294,9 @@ POST=0 /srv/cc-ci/.claude/skills/recipe-upgrade/testme-on-pr.sh <recipe> <pr-ind
|
|||||||
Read the failing run (linked from the PR / the harness log on cc-ci) and classify:
|
Read the failing run (linked from the PR / the harness log on cc-ci) and classify:
|
||||||
|
|
||||||
**5a. The UPGRADE itself is broken** (real regression: bad tag, missing migration, config gap) — fix
|
**5a. The UPGRADE itself is broken** (real regression: bad tag, missing migration, config gap) — fix
|
||||||
it on the recipe branch, push, and re-run `!testme` (within the 3-run budget). The recipe PR is only
|
it on the local recipe branch, then re-run `open-recipe-pr.sh` from step 3 to squash the corrected
|
||||||
|
tree into one commit on the PR branch **before** re-running `!testme` (within the 3-run budget).
|
||||||
|
Do not push a fix commit directly to the PR branch. The recipe PR is only
|
||||||
"working" once `!testme` is GREEN. If still red after 3 runs, leave the PR open (its red `!testme`
|
"working" once `!testme` is GREEN. If still red after 3 runs, leave the PR open (its red `!testme`
|
||||||
results stand as the evidence) and report `FAILED — upgrade not green after 3 !testme runs`.
|
results stand as the evidence) and report `FAILED — upgrade not green after 3 !testme runs`.
|
||||||
|
|
||||||
@@ -359,8 +358,8 @@ Always state explicitly that **nothing was merged** — the PR(s) await operator
|
|||||||
— never touch the gate. (Interim safeguard while the upgrader runs on the cc-ci host; see `IDEAS.md`.)
|
— 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
|
- **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
|
true upstream main and closes open PRs already merged upstream. It does NOT close superseded/unrelated
|
||||||
open PRs. **An existing open upgrade PR is extended (new work pushed onto its branch + re-tested)
|
open PRs. **An existing open upgrade PR is rewritten with one commit on the current upstream tip
|
||||||
rather than spawning a second upgrade PR** — one evolving upgrade PR per recipe.
|
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
|
- **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.
|
correct but a test is genuinely stale — never to paper over a real upgrade regression.
|
||||||
- **Never weaken a test**; **bounded** changes (the upgrade + minimal test update, not rewrites).
|
- **Never weaken a test**; **bounded** changes (the upgrade + minimal test update, not rewrites).
|
||||||
|
|||||||
@@ -20,11 +20,9 @@
|
|||||||
# never reflected it.
|
# never reflected it.
|
||||||
#
|
#
|
||||||
# Default mode (open a PR — preconditions: HEAD has the upgrade commit(s)):
|
# Default mode (open a PR — preconditions: HEAD has the upgrade commit(s)):
|
||||||
# - If an open UPGRADE PR already exists for this recipe (branch 'upgrade-*'), the new work is added
|
# - Publish the final recipe tree as ONE commit directly on current upstream main before !testme.
|
||||||
# as a commit ON TOP of THAT PR's branch (a fast-forward — NO force-push) and the PR is updated +
|
# If an open upgrade PR exists, replace its branch with this single commit using
|
||||||
# re-tested — ONE evolving upgrade PR per recipe, NOT a second parallel PR. Otherwise a fresh
|
# --force-with-lease, then re-test the same PR. Otherwise open a fresh upgrade PR.
|
||||||
# 'upgrade-<version>' branch + PR is opened. (The only force-push here is the mirror-main sync
|
|
||||||
# above, which intentionally mirrors upstream main; PR branches are never force-pushed.)
|
|
||||||
# - Unrelated open PRs (e.g. a backup fix) are NEVER closed or touched — left for the operator.
|
# - Unrelated open PRs (e.g. a backup fix) are NEVER closed or touched — left for the operator.
|
||||||
# - Only PRs already merged into upstream main are closed (no-op merges) — see above.
|
# - Only PRs already merged into upstream main are closed (no-op merges) — see above.
|
||||||
#
|
#
|
||||||
@@ -165,9 +163,8 @@ if [ "${MODE}" = "--reconcile-only" ]; then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# --- DEFAULT: if an open upgrade PR exists, push the new work onto ITS branch and re-test it, so
|
# --- DEFAULT: publish one commit with the final tree on current upstream main. This collapses
|
||||||
# there's ONE evolving upgrade PR per recipe rather than parallel ones. Only if none exists do we
|
# old local commits and merge commits while preserving the exact content to be tested. ---
|
||||||
# open a fresh upgrade-<version> PR. Unrelated open PRs are never touched. ---
|
|
||||||
if [ -n "${EXTEND_PR}" ]; then
|
if [ -n "${EXTEND_PR}" ]; then
|
||||||
BRANCH="${EXTEND_BRANCH}"
|
BRANCH="${EXTEND_BRANCH}"
|
||||||
echo "→ Extending existing open upgrade PR #${EXTEND_PR} (branch ${BRANCH}) with the new work — it will be re-tested; NOT opening a separate PR."
|
echo "→ Extending existing open upgrade PR #${EXTEND_PR} (branch ${BRANCH}) with the new work — it will be re-tested; NOT opening a separate PR."
|
||||||
@@ -178,39 +175,38 @@ else
|
|||||||
BRANCH="upgrade-$(git rev-parse --short HEAD)"
|
BRANCH="upgrade-$(git rev-parse --short HEAD)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Land the work on the PR branch WITHOUT force-pushing. If the branch already exists (extend case, or
|
# Do not create an empty PR when the proposed tree equals current upstream main.
|
||||||
# a stale same-named branch), add a commit ON TOP of its tip — a fast-forward, so the PR's history is
|
UPSTREAM_TREE=$(git rev-parse "${NEW_MAIN_SHA}^{tree}")
|
||||||
# preserved and it re-tests. Otherwise push a fresh branch.
|
WORK_TREE=$(git rev-parse 'HEAD^{tree}')
|
||||||
|
[ "${WORK_TREE}" != "${UPSTREAM_TREE}" ] || {
|
||||||
|
echo "ERROR: proposed recipe tree is identical to upstream main; nothing to PR."
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# The PR branch is a single commit on the current upstream tip. Reusing an existing PR requires a
|
||||||
|
# guarded rewrite; the lease rejects concurrent updates instead of overwriting another writer.
|
||||||
|
SQUASHED=$(GIT_AUTHOR_NAME="${GITEA_USERNAME}" GIT_AUTHOR_EMAIL="${GITEA_USERNAME}@git.autonomic.zone" \
|
||||||
|
GIT_COMMITTER_NAME="${GITEA_USERNAME}" GIT_COMMITTER_EMAIL="${GITEA_USERNAME}@git.autonomic.zone" \
|
||||||
|
git commit-tree "${WORK_TREE}" -p "${NEW_MAIN_SHA}" -m "${LATEST_MSG}")
|
||||||
if git rev-parse --verify --quiet "refs/remotes/gitea/${BRANCH}" >/dev/null; then
|
if git rev-parse --verify --quiet "refs/remotes/gitea/${BRANCH}" >/dev/null; then
|
||||||
EXIST_TIP=$(git rev-parse "refs/remotes/gitea/${BRANCH}")
|
EXIST_TIP=$(git rev-parse "refs/remotes/gitea/${BRANCH}")
|
||||||
if [ "$(git rev-parse 'HEAD^{tree}')" = "$(git rev-parse "${EXIST_TIP}^{tree}")" ]; then
|
if [ "$(git rev-parse "${EXIST_TIP}^{tree}")" = "${WORK_TREE}" ] &&
|
||||||
echo "→ '${BRANCH}' already has this exact tree — nothing new to push (will still re-test)."
|
[ "$(git rev-parse "${EXIST_TIP}^" 2>/dev/null || true)" = "${NEW_MAIN_SHA}" ]; then
|
||||||
|
echo "→ '${BRANCH}' already has this one-commit diff — nothing new to push (will still re-test)."
|
||||||
else
|
else
|
||||||
# Parent the new commit on the branch tip AND (when the branch predates it) on upstream main, so
|
echo "→ Replacing '${BRANCH}' with one commit on upstream ${NEW_MAIN_SHA:0:8} (force-with-lease)..."
|
||||||
# the recorded HISTORY matches the tree we are pushing. Without the second parent the merge-base
|
git push --force-with-lease="refs/heads/${BRANCH}:${EXIST_TIP}" gitea \
|
||||||
# stays stale: git would later treat upstream's post-branch changes as "removed by this PR" and a
|
"${SQUASHED}:refs/heads/${BRANCH}"
|
||||||
# merge could revert them (the gitea #5 / forgejo-removal drift, 2026-08-10). No force-push: this
|
|
||||||
# is still a fast-forward from the branch tip.
|
|
||||||
EXTRA_PARENT=()
|
|
||||||
if ! git merge-base --is-ancestor "${NEW_MAIN_SHA}" "${EXIST_TIP}"; then
|
|
||||||
EXTRA_PARENT=(-p "${NEW_MAIN_SHA}")
|
|
||||||
echo " (also parenting on upstream main ${NEW_MAIN_SHA:0:8} — branch predated it)"
|
|
||||||
fi
|
|
||||||
ONTOP=$(GIT_AUTHOR_NAME="${GITEA_USERNAME}" GIT_AUTHOR_EMAIL="${GITEA_USERNAME}@git.autonomic.zone" \
|
|
||||||
GIT_COMMITTER_NAME="${GITEA_USERNAME}" GIT_COMMITTER_EMAIL="${GITEA_USERNAME}@git.autonomic.zone" \
|
|
||||||
git commit-tree "$(git rev-parse 'HEAD^{tree}')" -p "${EXIST_TIP}" "${EXTRA_PARENT[@]}" -m "${LATEST_MSG}")
|
|
||||||
echo "→ Adding the new work on top of '${BRANCH}' (fast-forward, no force-push)..."
|
|
||||||
git push gitea "${ONTOP}:refs/heads/${BRANCH}"
|
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "→ Pushing new branch '${BRANCH}'..."
|
echo "→ Pushing one-commit branch '${BRANCH}' on upstream ${NEW_MAIN_SHA:0:8}..."
|
||||||
git push gitea "HEAD:refs/heads/${BRANCH}"
|
git push gitea "${SQUASHED}:refs/heads/${BRANCH}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
PR_BODY="${RECIPE_PR_BODY:-$(printf 'Recipe upgrade.\n\nCommits on top of upstream main:\n\n%s\n' "$(git log origin/main..HEAD --pretty='- %h %s')")}"
|
PR_BODY="${RECIPE_PR_BODY:-$(printf 'Recipe upgrade as one commit on upstream %s.\n\n%s\n' "${NEW_MAIN_SHA:0:8}" "$(git diff --stat "${NEW_MAIN_SHA}" "${SQUASHED}")")}"
|
||||||
PR_BODY="${PR_BODY}
|
PR_BODY="${PR_BODY}
|
||||||
|
|
||||||
Tested green on the cc-ci recipe CI server (full suite, cold, against this PR head). NOT merged — for operator review.
|
CI verification is run against this one-commit PR head. NOT merged — for operator review.
|
||||||
|
|
||||||
cc @trav @notplants"
|
cc @trav @notplants"
|
||||||
|
|
||||||
|
|||||||
@@ -197,7 +197,8 @@ description `"Upgrade <recipe> on cc-ci"`) with a prompt like:
|
|||||||
|
|
||||||
> Run the `/recipe-upgrade <recipe>` skill end-to-end — **DEFAULT mode, do NOT pass `--with-tests`**
|
> Run the `/recipe-upgrade <recipe>` skill end-to-end — **DEFAULT mode, do NOT pass `--with-tests`**
|
||||||
> (`/srv/cc-ci/.claude/skills/recipe-upgrade/SKILL.md`): plan, implement, **directly deploy + inspect
|
> (`/srv/cc-ci/.claude/skills/recipe-upgrade/SKILL.md`): plan, implement, **directly deploy + inspect
|
||||||
> the WIP on cc-ci for live feedback (step 2b, `--chaos`, tear it down after)**, open a recipe PR, and
|
> the WIP on cc-ci for live feedback (step 2b, `--chaos`, tear it down after)**, open a recipe PR as
|
||||||
|
> **one commit based on current upstream main**, and
|
||||||
> verify it by posting `!testme` on the PR (results visible in the PR; iterate ≤3×). Use the **existing
|
> verify it by posting `!testme` on the PR (results visible in the PR; iterate ≤3×). Use the **existing
|
||||||
> tests** — if a test fails because it is genuinely stale, **leave an explanatory comment on the PR**
|
> tests** — if a test fails because it is genuinely stale, **leave an explanatory comment on the PR**
|
||||||
> for the operator and do NOT modify any test. Drive cc-ci over `ssh cc-ci`. Do NOT prompt. Do NOT push
|
> for the operator and do NOT modify any test. Drive cc-ci over `ssh cc-ci`. Do NOT prompt. Do NOT push
|
||||||
|
|||||||
@@ -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.
|
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
|
# 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
|
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.
|
"""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
|
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:
|
else:
|
||||||
others.append((repo.split("/")[-1], prev_tag, tag))
|
others.append((repo.split("/")[-1], prev_tag, tag))
|
||||||
wins = ([app] if app else []) + others
|
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:
|
def main() -> int:
|
||||||
@@ -1395,7 +1397,8 @@ def main() -> int:
|
|||||||
a = ap.parse_args()
|
a = ap.parse_args()
|
||||||
images = []
|
images = []
|
||||||
if a.compose_to:
|
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:
|
if not wins:
|
||||||
print(f"### Advisory scan — {a.recipe}\n\n**No image versions changed between the two "
|
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}_")
|
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)
|
print(f"_derived from compose diff ({note}):_", file=sys.stderr)
|
||||||
for n_, f_, t_ in wins:
|
for n_, f_, t_ in wins:
|
||||||
print(f"_ {n_}: {f_} → {t_}_", file=sys.stderr)
|
print(f"_ {n_}: {f_} → {t_}_", file=sys.stderr)
|
||||||
# The `app` service (first entry when present) drives --from/--to; the rest are --image
|
# Only an actual app-service change defines the primary window. A sidecar-only PR must
|
||||||
# windows. Passing every window as --image too is harmless: each is matched by name against
|
# not be scanned as though its first sidecar were the application image.
|
||||||
# the advisory sources, and an unmatched name is simply ignored.
|
if app_changed:
|
||||||
a.v_from, a.v_to = a.v_from or wins[0][1], a.v_to or wins[0][2]
|
a.v_from, a.v_to = a.v_from or wins[0][1], a.v_to or wins[0][2]
|
||||||
images = list(wins[1:])
|
images = list(wins[1:])
|
||||||
|
else:
|
||||||
|
images = list(wins)
|
||||||
for spec in a.image:
|
for spec in a.image:
|
||||||
name, _, rng = spec.partition('=')
|
name, _, rng = spec.partition('=')
|
||||||
vf, _, vt = rng.partition(':')
|
vf, _, vt = rng.partition(':')
|
||||||
|
|||||||
@@ -100,7 +100,11 @@ def survey(date):
|
|||||||
if s.get("context") == "cc-ci/testme":
|
if s.get("context") == "cc-ci/testme":
|
||||||
ci = {"state": s.get("state"), "url": s.get("target_url"), "desc": s.get("description")}
|
ci = {"state": s.get("state"), "url": s.get("target_url"), "desc": s.get("description")}
|
||||||
rec["open_prs"].append({"number": p["number"], "title": p["title"],
|
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
|
# Per-recipe upgrade plan/summary (has the breaking-change + CVE/security analysis) — the agent
|
||||||
# mines this to lead with critical-CVE upgrades.
|
# mines this to lead with critical-CVE upgrades.
|
||||||
nf = os.path.join(LOGDIR, "upgrades", f"{r}-upgrade-{date}.md")
|
nf = os.path.join(LOGDIR, "upgrades", f"{r}-upgrade-{date}.md")
|
||||||
|
|||||||
@@ -746,6 +746,41 @@ volumes:
|
|||||||
def test_no_change_yields_no_windows(self):
|
def test_no_change_yields_no_windows(self):
|
||||||
self.assertEqual(self._windows(old=self.NEW, new=self.NEW), [])
|
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):
|
def test_templated_tags_are_skipped(self):
|
||||||
new = self.NEW.replace('ghcr.io/plausible/community-edition:v3.2.1', 'ghost:${IMAGE_VERSION}')
|
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)])
|
self.assertNotIn("ghost", [n for n, _, _ in self._windows(new=new)])
|
||||||
|
|||||||
Reference in New Issue
Block a user