Support issue-linked demo source changes
This commit is contained in:
@@ -9,6 +9,10 @@ import subprocess
|
||||
import tarfile
|
||||
import xml.etree.ElementTree as ET
|
||||
import zipfile
|
||||
import sys
|
||||
|
||||
sys.dont_write_bytecode = True
|
||||
from source_provenance import verify_source
|
||||
|
||||
root = Path.cwd()
|
||||
out = root / 'build/demo'
|
||||
@@ -33,6 +37,7 @@ assert (out / 'artifacts/TikZRefinery-report.pdf').is_file()
|
||||
assert (out / 'architecture/html/index.html').is_file()
|
||||
snapshot = json.loads((root / 'demo/snapshot.json').read_text())
|
||||
jenkins = bool(os.environ.get('BUILD_URL'))
|
||||
source_verification = verify_source(root / 'demo', require_tracked=jenkins)
|
||||
try:
|
||||
downstream = run('git', 'rev-parse', 'HEAD')
|
||||
modified = bool(run('git', 'status', '--porcelain', '--untracked-files=normal'))
|
||||
@@ -47,6 +52,7 @@ record = dict(delivery_version=version, application_baseline=snapshot['applicati
|
||||
downstream_commit_or_parent=downstream, downstream_modified=modified,
|
||||
execution='Jenkins' if jenkins else 'SSH command-line rehearsal; not a Jenkins run',
|
||||
build_url=os.environ.get('BUILD_URL'), source_sha256=source_hashes,
|
||||
source_verification=source_verification,
|
||||
toolchain=json.loads((root / 'demo/toolchain.json').read_text()))
|
||||
bundle = out / 'application-bundle'
|
||||
bundle.mkdir(exist_ok=True)
|
||||
@@ -56,6 +62,11 @@ for source, destination in [(out/'native/TikZRefinery',bundle/'TikZRefinery'),
|
||||
(out/'native/build-info.json',bundle/'build-info.json'),
|
||||
(root/'demo/snapshot.json',bundle/'upstream-snapshot.json')]:
|
||||
shutil.copy2(source, destination)
|
||||
if source_verification['source_change_record'] is not None:
|
||||
shutil.copy2(root / 'demo/source-change.json', bundle / 'source-change.json')
|
||||
else:
|
||||
# This generated staging directory can survive a previous changed-source run.
|
||||
(bundle / 'source-change.json').unlink(missing_ok=True)
|
||||
(bundle / 'delivery-info.json').write_text(json.dumps(record, indent=2) + '\n')
|
||||
image = ('ssw590-tikzrefinery' if jenkins else 'ssw590-tikzrefinery-rehearsal') + ':' + version
|
||||
exists = subprocess.run(['docker','image','inspect',image], stdout=subprocess.DEVNULL,stderr=subprocess.DEVNULL).returncode == 0
|
||||
|
||||
Reference in New Issue
Block a user