Prove CMS r39 restoration and version runtime fingerprints
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Build the fixed, data-only CMS r39 runtime reconciliation descriptor."""
|
||||
import argparse
|
||||
import gzip
|
||||
import hashlib
|
||||
import io
|
||||
import json
|
||||
from pathlib import Path
|
||||
import tarfile
|
||||
ROOT=Path(__file__).resolve().parent
|
||||
ENTRY='deployment/dc-cms-r39-runtime-reconciliation-v2.json'
|
||||
|
||||
|
||||
def bundle():
|
||||
descriptor=(ROOT/'runtime-reconciliation-v2.json').read_bytes()
|
||||
identity=json.loads(descriptor)['releaseId']
|
||||
members={'manifest.env':f'id={identity}\ncomponent=dc-cms-runtime-reconciliation\ntype=app-overlay\n'.encode(),
|
||||
'files.txt':(ENTRY+'\n').encode(),'payload/'+ENTRY:descriptor}
|
||||
output=io.BytesIO()
|
||||
with gzip.GzipFile(fileobj=output,mode='wb',mtime=0,filename='') as compressed:
|
||||
with tarfile.open(fileobj=compressed,mode='w') as archive:
|
||||
for name,value in sorted(members.items()):
|
||||
info=tarfile.TarInfo(name);info.mode=0o644;info.size=len(value)
|
||||
archive.addfile(info,io.BytesIO(value))
|
||||
return identity,output.getvalue()
|
||||
|
||||
|
||||
if __name__=='__main__':
|
||||
parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--output-dir',type=Path,required=True)
|
||||
args=parser.parse_args();args.output_dir.mkdir(parents=True,exist_ok=True)
|
||||
identity,data=bundle();path=args.output_dir/('nodedc-'+identity+'.tgz')
|
||||
with path.open('xb') as stream:stream.write(data)
|
||||
print(json.dumps({'artifact':str(path),'sha256':hashlib.sha256(data).hexdigest(),'id':identity}))
|
||||
Reference in New Issue
Block a user