a7971c4822
gates / gates (push) Successful in 25s
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
25 lines
1.3 KiB
Python
25 lines
1.3 KiB
Python
"""Set a mark on an app's ladder entry N in the DRILL catalog, commit, push, and wait for the box's clone.
|
|
Usage: python3 drillmark.py <app> <entry-index> '<marks-json>'"""
|
|
import json, sys, subprocess, time
|
|
import walk as w
|
|
app, idx, marks = sys.argv[1], int(sys.argv[2]), json.loads(sys.argv[3])
|
|
p = f"{w.DRILL}/templates/{app}/.felhom.yml"
|
|
w.sh(["git", "-C", w.DRILL, "pull", "-q", "--rebase", "origin", "main"], timeout=120)
|
|
lines = open(p).read().split("\n")
|
|
i = lines.index("update_ladder:") + 1 + idx
|
|
e = json.loads(lines[i][4:]); e["marks"] = marks
|
|
lines[i] = " - " + json.dumps(e, ensure_ascii=False)
|
|
open(p, "w").write("\n".join(lines))
|
|
w.sh(["git", "-C", w.DRILL, "commit", "-qam", f"NIGHT-C {app} step {idx+1} marks {json.dumps(marks)}"])
|
|
w.sh(["git", "-C", w.DRILL, "push", "-q", "origin", "main"], timeout=120)
|
|
head = w.sh(["git", "-C", w.DRILL, "rev-parse", "--short", "HEAD"]).stdout.strip()
|
|
w.login()
|
|
for k in range(40):
|
|
w.sync_rescan()
|
|
got = w.guest("cd /var/lib/docker/volumes/felhom-controller-data/_data/data/catalog-cache && git rev-parse --short HEAD").strip()
|
|
if got == head:
|
|
print(f"{app} step {idx+1} marks={marks}; box clone at {head} after {k+1} sync(s)"); break
|
|
time.sleep(8)
|
|
else:
|
|
sys.exit("box never caught up to " + head)
|