Resume: rebuild every variant when the CLI binary changed
This commit is contained in:
parent
b80321d0e3
commit
e526bc3e58
1 changed files with 19 additions and 1 deletions
|
|
@ -142,6 +142,10 @@ def main():
|
|||
shlex.join(['systemd-run', '--wait', '--pipe', '--unit=' + unit,
|
||||
'--property=RuntimeMaxSec=' + str(timeout),
|
||||
'bash', '-euo', 'pipefail', '-c', script])], timeout + 60)
|
||||
def remote_text(script):
|
||||
result = subprocess.run(['ssh', '-o', 'BatchMode=yes', '-o', 'ConnectTimeout=20', worker, script],
|
||||
capture_output=True, text=True)
|
||||
return result.stdout.strip() if result.returncode == 0 else ''
|
||||
def tools(argv, signing=False):
|
||||
mounts = ['--mount', f'type=bind,src={base}/data,dst={base}/data',
|
||||
'--mount', f'type=bind,src={run}/pipeline,dst=/pipeline,readonly']
|
||||
|
|
@ -216,6 +220,10 @@ def main():
|
|||
+ views[-1] + '/$repo/os/$arch')
|
||||
state['snapshot_url'] = snapshot_url
|
||||
# Compile from the frozen source tree, not a possibly stale deployed CLI.
|
||||
previous_binary = ''
|
||||
if resume:
|
||||
previous_binary = remote_text('sha256sum ' + shlex.quote(remote_root + '/archipelago')
|
||||
+ " | cut -d' ' -f1")
|
||||
phase('freezing-and-compiling-source')
|
||||
remote(f'''tar --exclude=.git --exclude=target --exclude=__pycache__ -C {shlex.quote(config['worker_source_root'])} -cf {remote_root}/source.tar src
|
||||
mkdir -p {remote_root}/source
|
||||
|
|
@ -231,6 +239,14 @@ sha256sum {remote_root}/archipelago > {remote_root}/inputs.sha256
|
|||
sha256sum {remote_root}/archipelagod >> {remote_root}/inputs.sha256
|
||||
sha256sum {remote_root}/source.tar >> {remote_root}/inputs.sha256
|
||||
find {remote_root}/probes -type f -name '*.py' -exec sha256sum {{}} + >> {remote_root}/inputs.sha256''')
|
||||
binary_changed = False
|
||||
if resume and previous_binary:
|
||||
current_binary = remote_text('sha256sum ' + shlex.quote(remote_root + '/archipelago')
|
||||
+ " | cut -d' ' -f1")
|
||||
binary_changed = bool(current_binary) and current_binary != previous_binary
|
||||
if binary_changed:
|
||||
print(json.dumps({'event': 'core-rebuild-required',
|
||||
'reason': 'CLI binary changed since the previous attempt'}), flush=True)
|
||||
call(['rsync', '-a', f'{worker}:{remote_root}/service-contract-checks.log', str(run / 'service-contract-checks.log')])
|
||||
call(['rsync', '-a', f'{worker}:{remote_root}/control-portal-checks.log', str(run / 'control-portal-checks.log')])
|
||||
# D-098 amendment (2026-11-10): Flatpak seeds change only with the monthly
|
||||
|
|
@ -303,7 +319,9 @@ find {remote_root}/probes -type f -name '*.py' -exec sha256sum {{}} + >> {remote
|
|||
env = 'env ' + ' '.join(shlex.quote(k + '=' + v) for k, v in build_env.items())
|
||||
|
||||
def variant_done(variant):
|
||||
if not resume:
|
||||
# A changed CLI invalidates every existing variant: the purpose layer
|
||||
# asserts byte identity between the Core payload and this binary.
|
||||
if not resume or binary_changed:
|
||||
return False
|
||||
probe = ('test -d ' + shlex.quote(builds[variant]) + '/output && test -d '
|
||||
+ shlex.quote(builds[variant]) + '/repo')
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue