From 6262b8b6482fa915d7bd043b65806bb4db48b0e5 Mon Sep 17 00:00:00 2001 From: FoggyMtnDrifter Date: Mon, 23 Nov 2026 08:42:55 -0500 Subject: [PATCH] Fix actual-budget listing ref and keep bump refs in sync (#34) The bump bot updated the digest in cottage.yml but kept the old ref, so Cottage's sync skipped actual-budget (template uses 26.11.0, listing recorded 25.11.0). Correct the ref, make the bot rewrite it with the digest, and add a CI check for Cottage's listing-image rule. --- .github/check-listing-images.py | 22 ++++++++++++++++++++++ .github/workflows/validate.yml | 10 ++++++++++ apps/actual-budget/cottage.yml | 2 +- scripts/bump.py | 6 ++++-- 4 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 .github/check-listing-images.py diff --git a/.github/check-listing-images.py b/.github/check-listing-images.py new file mode 100644 index 0000000..1a129d2 --- /dev/null +++ b/.github/check-listing-images.py @@ -0,0 +1,22 @@ +"""Every image a recipe's template.yml runs must be listed, with a digest, in its cottage.yml. + +The same rule Cottage applies when it syncs the catalog: a recipe that breaks it is skipped. +""" +import glob, os, re, sys, yaml + +DIGEST = re.compile(r"sha256:[0-9a-f]{64}") +bad = [] +for d in sorted(glob.glob("apps/*/")): + tpl = yaml.safe_load(open(os.path.join(d, "template.yml"))) + listing = yaml.safe_load(open(os.path.join(d, "cottage.yml"))) + recorded = {} + for im in listing.get("images") or []: + recorded[im.get("ref")] = im.get("digest", "") + if not DIGEST.fullmatch(str(im.get("digest", ""))): + bad.append(f"{d}cottage.yml: image {im.get('ref')} needs a sha256 digest") + for name, svc in (tpl.get("services") or {}).items(): + img = (svc or {}).get("image") + if img and img not in recorded: + bad.append(f"{d}cottage.yml: image {img} (service {name}) is used by template.yml but has no recorded digest") +print("\n".join(bad) or "every template image has a recorded digest") +sys.exit(1 if bad else 0) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index f1c1210..7daf2e2 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -50,6 +50,16 @@ jobs: - run: pip install --quiet jsonschema pyyaml - run: python3 .github/check-parameters.py + # Cottage skips a recipe at sync time if its template runs an image the listing has no + # digest for, so catch that here. + listing-images: + name: Listing images + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - run: pip install --quiet pyyaml + - run: python3 .github/check-listing-images.py + compose: name: Docker Compose test runs-on: ubuntu-latest diff --git a/apps/actual-budget/cottage.yml b/apps/actual-budget/cottage.yml index a3fdeb3..5a39ee2 100644 --- a/apps/actual-budget/cottage.yml +++ b/apps/actual-budget/cottage.yml @@ -8,7 +8,7 @@ upstream: https://github.com/actualbudget/actual website: https://actualbudget.org license: MIT images: - - ref: actualbudget/actual-server:25.11.0 + - ref: actualbudget/actual-server:26.11.0 digest: sha256:06cf186569cf58d93e12659ff1a517b65b5b0ebee7050a3991d4bd8a1d398da6 mobile_apps: false # The first visit sets the server password. diff --git a/scripts/bump.py b/scripts/bump.py index 0338ef4..9efd34c 100755 --- a/scripts/bump.py +++ b/scripts/bump.py @@ -220,10 +220,12 @@ def apply_bump(slug, cur, new, t, images, version): if cur in rest or old_tag in rest: return "the old version is used elsewhere in template.yml" tpl = tpl.replace(old_ref, new_ref).replace(f'version: "{version}"', f'version: "{new}-c1"') - pat = re.compile(r"(- ref: " + re.escape(old_ref) + r"\n\s+digest: )sha256:[0-9a-f]{64}") + pat = re.compile(r"(- ref: )" + re.escape(old_ref) + r"(\n\s+digest: )sha256:[0-9a-f]{64}") if not pat.search(cot): return "digest line not found in cottage.yml" - cot = pat.sub(lambda m: m.group(1) + digest, cot) + # The listing's ref must change with the template's: Hearth refuses a recipe whose + # template uses an image the listing has no digest for. + cot = pat.sub(lambda m: m.group(1) + new_ref + m.group(2) + digest, cot) open(tp, "w").write(tpl) open(cp, "w").write(cot) return old_ref, new_ref, digest