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.
This commit is contained in:
michael authored and GitHub committed 2026-11-23 08:42:55 -05:00
1 parent 2868418a60
commit 6262b8b648
4 files changed
+37 -3

No files matched your search

+22
View File
@@ -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)
+10
View File
@@ -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
+1 -1
View File
@@ -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.
+4 -2
View File
@@ -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