| 123456789101112131415161718192021222324252627282930313233343536373839 |
- """Assemble deployment tooling around the frozen, publicly baselined source."""
- import hashlib
- import json
- from pathlib import Path
- import subprocess
- ROOT = Path(__file__).resolve().parents[1]
- PKG = ROOT / 'work/board-deploy-20261106-r1/package'
- manifest = json.loads((PKG / 'deploy/board-files.json').read_text(encoding='utf-8'))
- publisher = (ROOT / 'scripts/publish-opportunity-ui.mjs').read_text(encoding='utf-8')
- start = publisher.index('export const FILES=Object.freeze([')
- end = publisher.index(']);', start) + 3
- publisher = publisher[:start] + 'export const FILES=Object.freeze(' + json.dumps([f['path'] for f in manifest['files']]) + ');' + publisher[end:]
- publisher = publisher.replace('ksf.opportunity-ui.publish.v1', 'ksf.board.publish.v1').replace('ksf.opportunity-ui.20261103.v1', 'ksf.board.20261106.r1')
- publisher = publisher.replace('filesChecked:6', 'filesChecked:FILES.length')
- publisher = publisher.replace('ksf-opportunity-ui', 'ksf-board')
- publisher = publisher.replace("sourceDir:root,manifestPath:path.join(root,'deploy/opportunity-ui-files-20261103.json')", "sourceDir:path.join(root,'payload'),manifestPath:path.join(root,'deploy/board-files.json')")
- (PKG / 'scripts').mkdir(exist_ok=True)
- (PKG / 'scripts/publish-board.mjs').write_text(publisher, encoding='utf-8', newline='\n')
- for name in ('test_board_library.py', 'test_retrieval.py', 'test_voc_db.py'):
- p = 'server/voc-library/' + name
- (PKG / 'payload' / p).write_bytes(subprocess.check_output(['git', 'show', manifest['commit'] + ':' + p], cwd=ROOT))
- metadata = {
- 'release': manifest['release'], 'commit': manifest['commit'], 'origin': manifest['origin'],
- 'productionInstalled': False, 'databaseIncluded': False, 'skillsIncluded': False,
- 'homepageIncluded': False, 'devServerIncluded': False, 'credentialsIncluded': False,
- 'staticFiles': len(manifest['files']), 'expectedStaticChanges': sum(f['changed'] for f in manifest['files']),
- 'expectedNewStaticFiles': sum(f['allowMissing'] for f in manifest['files']),
- 'functions': json.loads((PKG / 'payload/server/dist/member-groups/manifest.json').read_text())['functions'],
- 'requiredDatabasePackage': {'name': 'ksf-voc-database-20261106-r1.zip',
- 'bytes': 25913256, 'sha256': '1ba1ac2fa6a8b774f8945d88e014c07dd5e03332792af298a41f015ba6946f9f'},
- 'database': {'schema': 'ksf.voc-library.v2',
- 'generation': '7e0df42395d9d2ea39dd5b537d17ae35ac910cc29721ed92a680b7fe6b25c92c',
- 'bytes': 98918400, 'sha256': '944e4bb3a5d65dd897ea7c912e1af001aa845db1ba1f968a7b0ee653dc60fa50'},
- 'productionPreflight': {'readOnly': True, 'productionWrites': 0, 'memberGroupsReadHttp': 404, 'libraryVersionHttp': 404},
- }
- (PKG / 'RELEASE.json').write_text(json.dumps(metadata, ensure_ascii=False, indent=2) + '\n', encoding='utf-8')
- print(json.dumps({'ok': True, 'staticFiles': metadata['staticFiles'], 'expectedChanges': metadata['expectedStaticChanges'], 'functionCount': len(metadata['functions'])}))
|