Archive build logs as lightweight evidence
Sync changed files to Google Drive / sync (push) Successful in 1m35s

This commit is contained in:
admin_d committed 2026-09-15 11:04:58 +05:00
1 parent c2127c3f31
commit 89aa918954
9 files changed
+129

No files matched your search

+11
View File
@@ -14,6 +14,7 @@ from artifacts import inspect_elf, inspect_apk
from resource_staging import stage_runtime_resources
IMAGE_TAG='kambi/castle-engine-cloud-builds-tools:cge-unstable'
BUILD_EVIDENCE_DIR=ROOT/'build-evidence'
def cge_command(cpu:str,action:str)->list[str]:
if cpu not in CPUS:raise ProbeError('Unsupported Android CPU')
if action not in ('compile','package'):raise ProbeError('Not an Android build action')
@@ -62,6 +63,15 @@ def _record(build_id:str, cpu:str, status:str, application:dict|None=None,
'package':package or {'status':'NOT_RUN','exit_code':None},
'package_metadata':package_metadata,'error':error}
def _publish_build_evidence(record:dict)->None:
source=ROOT/'build'/record['build_id']/'logs'
destination=BUILD_EVIDENCE_DIR/record['build_id']/'logs'
destination.mkdir(parents=True,exist_ok=True)
if source.is_dir():
for path in source.iterdir():
if path.is_file():shutil.copy2(path,destination/path.name)
write_json(destination.parent/'build.json',record)
def _finish(record:dict)->int:
if record['status']!='PASS':
CURRENT_OUTPUT_DIR.mkdir(parents=True,exist_ok=True)
@@ -69,6 +79,7 @@ def _finish(record:dict)->int:
path.unlink(missing_ok=True)
record['package_metadata']=None
write_json(CURRENT_BUILD_METADATA,record)
_publish_build_evidence(record)
return {'PASS':0,'FAIL':1,'BLOCKED':2}[record['status']]
def _valid_docker_handoff(record:object,build_id:str,code:int)->bool: