86c4b9a0d8
gates / gates (push) Successful in 27s
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
61 lines
2.3 KiB
Python
61 lines
2.3 KiB
Python
#!/usr/bin/env python3
|
|
"""Part D spike (30 min) on guest 9202, controller v0.267.0, drill catalog.
|
|
|
|
1. an app two steps behind (vikunja A=2.4.0 -> B=2.5.0 -> C=2.6.0): does ONE press jump A -> C today?
|
|
2. does a `templates/<app>/steps/` folder reach the box? (it is read from the catalog clone)
|
|
Evidence only; every act is a product endpoint."""
|
|
import json, os, sys, time
|
|
sys.path.insert(0, ".")
|
|
import walk as w
|
|
|
|
DRILL = w.DRILL
|
|
CACHE = "/var/lib/docker/volumes/felhom-controller-data/_data/catalog-cache"
|
|
|
|
|
|
def commit(msg, edit):
|
|
edit()
|
|
w.sh(["git", "-C", DRILL, "add", "-A"])
|
|
w.sh(["git", "-C", DRILL, "commit", "-q", "-m", msg])
|
|
r = w.sh(["git", "-C", DRILL, "push", "-q", "origin", "main"], timeout=120)
|
|
h = w.sh(["git", "-C", DRILL, "rev-parse", "--short=12", "HEAD"]).stdout.strip()
|
|
w.say(f"drill commit {h}: {msg} (push rc={r.returncode})")
|
|
return h
|
|
|
|
|
|
def set_img(ref):
|
|
p = f"{DRILL}/templates/vikunja/docker-compose.yml"
|
|
s = open(p).read()
|
|
import re
|
|
s = re.sub(r"image: vikunja/vikunja:\S+", f"image: vikunja/vikunja:{ref}", s)
|
|
open(p, "w").write(s)
|
|
|
|
|
|
out = {}
|
|
commit("SPIKE vikunja A=2.4.0", lambda: set_img("2.4.0"))
|
|
w.login()
|
|
w.sync_rescan("vikunja", "vikunja/vikunja:2.4.0")
|
|
ok = w.deploy("vikunja", "vikunja-sp")
|
|
out["deployed_A"] = ok
|
|
out["A"] = w.observables("vikunja")
|
|
|
|
|
|
def step_b():
|
|
set_img("2.5.0")
|
|
os.makedirs(f"{DRILL}/templates/vikunja/steps", exist_ok=True)
|
|
open(f"{DRILL}/templates/vikunja/steps/spike-B.yml", "w").write(
|
|
open(f"{DRILL}/templates/vikunja/docker-compose.yml").read())
|
|
|
|
|
|
commit("SPIKE vikunja B=2.5.0 + steps/spike-B.yml", step_b)
|
|
commit("SPIKE vikunja C=2.6.0", lambda: set_img("2.6.0"))
|
|
out["badge_wait_s"] = w.sync_rescan("vikunja", "vikunja/vikunja:2.6.0")
|
|
out["cache_steps"] = w.guest(f"git -C {CACHE} rev-parse --short=12 HEAD; git -C {CACHE} rev-list --count HEAD; ls -la {CACHE}/templates/vikunja/ {CACHE}/templates/vikunja/steps/ 2>&1; ls /opt/docker/stacks/vikunja/")
|
|
w.say("cache:\n" + out["cache_steps"])
|
|
out["badges"] = w.badges("vikunja")
|
|
out["press"] = w.press_update("vikunja")
|
|
out["after"] = w.observables("vikunja")
|
|
w.say("after: " + json.dumps(out["after"]))
|
|
w.remove("vikunja")
|
|
json.dump(out, open("../partD/00-spike.json", "w"), indent=2, ensure_ascii=False)
|
|
open("../partD/00-spike.log", "w").write("\n".join(w.LOG) + "\n")
|