Gate site-specific limited release on five exact approvals and verified frozen export bytes
This commit is contained in:
1 parent
2676e474a1
commit
f2494e8d1f
4 files changed
+72
-4
No files matched your search
@@ -4,7 +4,7 @@ from pathlib import Path,PurePosixPath
|
||||
import argparse,gzip,hashlib,json,os,re,shutil,subprocess,sys,tarfile,tempfile
|
||||
ROOT=Path(__file__).resolve().parents[1]
|
||||
ROLES={'designer','creative_director','content_manager','illustrator','programmer_expert'}
|
||||
DEPLOY_FILES=['Dockerfile','deploy/nginx.conf','deploy/legacy-map.conf','deploy/legacy-matchers.json','deploy/legacy-routes.json','deploy/serve-local.py','deploy/stack.yml','deploy/release-artifact.py','.gitea/workflows/master.yml']
|
||||
DEPLOY_FILES=['Dockerfile','deploy/nginx.conf','deploy/legacy-map.conf','deploy/legacy-matchers.json','deploy/legacy-routes.json','deploy/serve-local.py','deploy/stack.yml','deploy/release-artifact.py','deploy/verify-published-corpus.py','.gitea/workflows/master.yml']
|
||||
def sha(b):return hashlib.sha256(b).hexdigest()
|
||||
def hash_manifest(rows):return sha(json.dumps(rows,ensure_ascii=False,sort_keys=True,separators=(',',':')).encode())
|
||||
def require(ok,message):
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Bounded publication gate; full historical restoration remains explicit."""
|
||||
from pathlib import Path
|
||||
import argparse,json,os,subprocess,sys
|
||||
ROOT=Path(__file__).resolve().parents[1]
|
||||
p=argparse.ArgumentParser();p.add_argument('--manifest',required=True);p.add_argument('--base',required=True);p.add_argument('--report',required=True);args=p.parse_args()
|
||||
subprocess.run([sys.executable,str(ROOT/'deploy/release-artifact.py'),'verify','--manifest',args.manifest,'--tree','web-front/out'],cwd=ROOT,check=True)
|
||||
report=Path(args.report);report.unlink(missing_ok=True)
|
||||
env=dict(os.environ,PYTHONPATH=str(ROOT/'scripts/rebuild-v2/vendor'),PYTHONDONTWRITEBYTECODE='1',VIDEOREG_RASTER_DECODER='sharp')
|
||||
r=subprocess.run([sys.executable,'-S',str(ROOT/'scripts/rebuild-v2/check-built.py'),'--base',args.base,'--report',str(report)],cwd=ROOT,env=env)
|
||||
if not report.is_file():raise SystemExit('No fresh complete crawl report; cannot publish')
|
||||
x=json.loads(report.read_text());m=json.loads((ROOT/args.manifest).read_text());summary=x['summary']
|
||||
if r.returncode not in (0,1) or summary['technicalStatus']!='passed' or summary['errors'] or x['errors']:raise SystemExit('Published corpus technical gate failed')
|
||||
if x['sourceCommit']!=m['sourceCommit'] or x['sourceManifestSha256']!=m['appSourceManifestSha256'] or x['exportManifestSha256']!=m['exportManifestSha256']:raise SystemExit('Crawl checked another artifact')
|
||||
print(json.dumps(dict(publishedCorpusTechnicalGate='passed',scope=m['scope'],sourceCommit=x['sourceCommit'],exportManifestSha256=x['exportManifestSha256'],roleApprovals=len(m['roleApprovals']),fullHistoricalRestorationAccepted=False,fullHistoricalRestorationStatus=summary['restorationStatus'],unresolved=summary['unresolvedInventoryItems'])))
|
||||
Reference in new issue
Block a user