fix(editorial): fence runner identity before claim and expose safe stages

This commit is contained in:
devops authored and devops committed 2026-10-24 10:28:30 +00:00
1 parent 60a4e14b4b
commit 01b6f1d3d7
4 files changed
+145 -14

No files matched your search

+5 -3
View File
@@ -107,13 +107,15 @@ def provision(sha, uid, gid):
env=dict(v.split('=',1) for v in h['Config']['Env'] if '=' in v)
home=Path(env.get('HERMES_HOME',''));safe(home)
if not any(home==Path(v['Destination']) or Path(v['Destination']) in home.parents for v in h['Mounts'] if v['Type'] in ('bind','volume')):raise ValueError('Persistent home required')
# No --user override: Docker executes as configured runtime identity, not host UID.
# Match the supervised Hermes/shim identity, NOT Docker Config.User (root).
# Existing root-owned installations fail closed; owner-reviewed CI migration
# is required rather than recursive chown of profiles or credentials.
source=Path(__file__).read_text()
payload=package(Path(__file__).resolve().parents[1]/'infra/hermes-editorial',sha)
code="import json,sys; p=json.load(sys.stdin); ns={'__name__':'editorial_stream'}; exec(compile(p['source'],'<ci-editorial>','exec'),ns); print(json.dumps(ns['install'](ns['Path'](p['home']),p['payload'])))"
result=json.loads(docker('exec','-i','canina-hermes','python3','-B','-c',code,data=json.dumps({'source':source,'home':str(home),'payload':payload})))
result=json.loads(docker('exec','--user','hermes','-i','canina-hermes','python3','-B','-c',code,data=json.dumps({'source':source,'home':str(home),'payload':payload})))
for profile in PROFILES:
discovered=docker('exec','-e','HERMES_HOME='+str(home/'profiles'/profile),'canina-hermes','/opt/hermes/bin/hermes','skills','list')
discovered=docker('exec','--user','hermes','-e','HERMES_HOME='+str(home/'profiles'/profile),'canina-hermes','/opt/hermes/bin/hermes','skills','list')
if 'canina-editorial-v4' not in discovered:raise ValueError('Hermes CLI skill discovery failed')
path=Path('/opt/services/canina/stage-runtime/secrets/prepare_worker_grants');safe(path)
st=path.lstat()