Replace VM acceptance with Rust checks and split OSTree/ISO cadence (D-098)
This commit is contained in:
parent
de2c8187f0
commit
29bed3fc1c
15 changed files with 419 additions and 305 deletions
|
|
@ -30,8 +30,8 @@ function drawStatus(s) {
|
|||
status=s;const active=['active','activating'].includes(s.service.ActiveState);const stopping=s.service.ActiveState==='deactivating';
|
||||
$('service').textContent=stopping?'Останавливается':active?'Выполняется':'Ожидает запуска';
|
||||
$('service-detail').textContent=`systemd: ${s.service.ActiveState} / ${s.service.SubState}`;
|
||||
$('schedule').textContent=s.timer.ActiveState==='active'?'15 / 30 · 00:00 UTC':'Приостановлено';
|
||||
$('next').textContent='Следующий: '+(s.timer.NextElapseUSecRealtime || '—');
|
||||
$('schedule').textContent=s.timer.ActiveState==='active'?'OSTree: 3 дня · ISO: 30-го':'Приостановлено';
|
||||
$('next').textContent='Следующий: '+(s.timer.ActiveState==='active' && s.next_release ? `${s.next_release.date} · ${s.next_release.mode} · ${s.next_release.time}` : '—');
|
||||
$('start').disabled=active||stopping;$('stop').disabled=!active;$('toggle-schedule').disabled=false;
|
||||
$('toggle-schedule').textContent=s.timer.ActiveState==='active'?'Ⅱ Приостановить расписание':'↻ Включить расписание';
|
||||
const published=s.runs.find(r=>r.published);$('published').textContent=published?'Опубликовано':'Нет данных';$('published-detail').textContent=published?.run || 'Публикация не подтверждена';
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
<div id="error" role="alert" hidden></div>
|
||||
<section class="overview">
|
||||
<article><span class="eyebrow">01 / PIPELINE</span><strong id="service">—</strong><small id="service-detail">Чтение systemd</small></article>
|
||||
<article><span class="eyebrow">02 / SCHEDULE</span><strong id="schedule">—</strong><small id="next">15 и 30 числа · 00:00 UTC</small></article>
|
||||
<article><span class="eyebrow">02 / SCHEDULE</span><strong id="schedule">—</strong><small id="next">Каждые 3 дня; ISO 30-го · 00:00 UTC</small></article>
|
||||
<article><span class="eyebrow">03 / PUBLICATION</span><strong id="published">—</strong><small id="published-detail">Только по результату конвейера</small></article>
|
||||
</section>
|
||||
<section class="toolbar"><div class="controls"><button id="start" class="primary" disabled>▶ Запустить сборку</button><button id="stop" class="danger" disabled>■ Остановить</button><button id="toggle-schedule" disabled>Расписание</button></div><span id="action-result" role="status">Лимит каждого действия: 4 часа</span></section>
|
||||
|
|
|
|||
|
|
@ -17,6 +17,9 @@ from urllib.parse import parse_qs, urlsplit
|
|||
SPEC = importlib.util.spec_from_file_location('monitor', Path(__file__).parents[1] / 'pipeline/monitor.py')
|
||||
monitor = importlib.util.module_from_spec(SPEC)
|
||||
SPEC.loader.exec_module(monitor)
|
||||
SCHEDULE_SPEC = importlib.util.spec_from_file_location('release_schedule', Path(__file__).parents[1] / 'pipeline/release-schedule.py')
|
||||
schedule = importlib.util.module_from_spec(SCHEDULE_SPEC)
|
||||
SCHEDULE_SPEC.loader.exec_module(schedule)
|
||||
RUN = re.compile(r'[0-9]{8}T[0-9]{6}Z')
|
||||
SERVICE = 'archipelago-release-cycle.service'
|
||||
TIMER = 'archipelago-release-cycle.timer'
|
||||
|
|
@ -143,6 +146,7 @@ class Handler(BaseHTTPRequestHandler):
|
|||
query = parse_qs(url.query)
|
||||
if url.path == '/api/status':
|
||||
return self.result({'service': app.unit(SERVICE), 'timer': app.unit(TIMER),
|
||||
'next_release': schedule.next_release(datetime.now(timezone.utc)),
|
||||
'runs': app.runs(), 'time': datetime.now(timezone.utc).isoformat(),
|
||||
'sources': read_json(Path(app.config['worker_source_root']) / 'src/source-revisions.json', {})})
|
||||
if url.path == '/api/run':
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
[Unit]
|
||||
Description=Archipelago build, VM acceptance, signing and publication
|
||||
Description=Archipelago Rust checks, build, signing and publication
|
||||
Wants=network-online.target
|
||||
After=network-online.target docker.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
Environment="ARCHIPELAGO_RELEASE_REASON=Operational release cycle (D-090/D-091)"
|
||||
Environment="ARCHIPELAGO_RELEASE_REASON=Rust/manual release cycle (D-098)"
|
||||
ExecStart=/usr/bin/python3 /opt/archipelago/src/infrastructure/pipeline/release-cycle.py
|
||||
ExecStopPost=/usr/bin/python3 /opt/archipelago/src/infrastructure/pipeline/cycle-terminal.py
|
||||
# Each worker action is bounded to four hours by the release driver.
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
[Unit]
|
||||
Description=Archipelago release cycle on the 15th and 30th at 00:00 UTC
|
||||
Description=Archipelago three-day OSTree and monthly ISO dispatcher
|
||||
|
||||
[Timer]
|
||||
OnCalendar=*-*-15,30 00:00:00 UTC
|
||||
OnCalendar=*-*-* 00:00:00 UTC
|
||||
Persistent=true
|
||||
AccuracySec=1min
|
||||
Unit=archipelago-release-cycle.service
|
||||
Unit=archipelago-release-schedule.service
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
||||
|
|
|
|||
6
deploy/archipelago-release-schedule.service
Normal file
6
deploy/archipelago-release-schedule.service
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
[Unit]
|
||||
Description=Dispatch anchored three-day OSTree and day-30 ISO releases
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/bin/python3 /opt/archipelago/release-dbus-coordinator/infrastructure/pipeline/release-schedule.py
|
||||
|
|
@ -17,17 +17,15 @@ def cleanup(parent, active):
|
|||
state = json.loads(state_file.read_text())
|
||||
if state.get('state') in ('complete', 'failed') and path.name != active:
|
||||
runs.append((path, state))
|
||||
# Keep three completed publications and one failed run's bulky artifacts.
|
||||
complete = [p for p, s in runs if s['state'] == 'complete']
|
||||
failed = [p for p, s in runs if s['state'] == 'failed']
|
||||
keep = set(complete[-3:] + failed[-1:])
|
||||
# D-098: retain source/evidence, not duplicate archived repositories/rootfs.
|
||||
keep = set()
|
||||
removed = []
|
||||
for path, state in runs:
|
||||
if path in keep:
|
||||
continue
|
||||
# Explicit artifact locations only. Keep source, status and evidence.
|
||||
for root in (path, path / 'failure-evidence'):
|
||||
for variant in ('core', 'gnome'):
|
||||
for variant in ('core', 'gnome', 'kde'):
|
||||
build = root / variant / 'build'
|
||||
if not build.resolve().is_relative_to(path.resolve()):
|
||||
raise ValueError('Build directory escapes run: ' + str(build))
|
||||
|
|
@ -45,6 +43,6 @@ def cleanup(parent, active):
|
|||
shutil.rmtree(target)
|
||||
removed.append(str(target))
|
||||
record = path / 'artifact-cleanup.json'
|
||||
record.write_text(json.dumps({'policy': 'three-complete-one-failed',
|
||||
record.write_text(json.dumps({'policy': 'evidence-only-D-098',
|
||||
'artifacts_expired': True}, indent=2) + '\n')
|
||||
return removed
|
||||
|
|
|
|||
38
pipeline/compact-ostree.py
Normal file
38
pipeline/compact-ostree.py
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
#!/usr/bin/env python3
|
||||
"""Keep current public image/layer refs; resign summary after pruning history."""
|
||||
import argparse
|
||||
import fcntl
|
||||
import json
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
|
||||
def compact(public, home, key):
|
||||
with (public / '.publish.lock').open('a') as lock:
|
||||
fcntl.flock(lock, fcntl.LOCK_EX | fcntl.LOCK_NB)
|
||||
current = (public / 'current').resolve(strict=True)
|
||||
refs = set(json.loads((current / 'publication-refs.json').read_text()).values())
|
||||
for kind in ('images', 'layers'):
|
||||
repo = current / 'ostree' / kind
|
||||
def ostree(*args):
|
||||
return subprocess.check_output(['ostree', '--repo=' + str(repo), *args], text=True).strip()
|
||||
keep = refs | ({'purpose/desktop/gnome', 'purpose/desktop/kde'} if kind == 'layers' else set())
|
||||
for ref in ostree('refs').splitlines():
|
||||
if ref not in keep:
|
||||
ostree('refs', '--delete', ref)
|
||||
print(kind, ostree('prune', '--refs-only', '--depth=0'), flush=True)
|
||||
ostree('summary', '--update', '--gpg-sign=' + key, '--gpg-homedir=' + str(home))
|
||||
print(kind, ostree('refs'), flush=True)
|
||||
history = current / 'history.json'
|
||||
old = json.loads(history.read_text())
|
||||
iso_history = current / 'iso-history.json'
|
||||
if not iso_history.exists():
|
||||
iso_history.write_text(json.dumps(old, indent=2) + '\n')
|
||||
history.write_text(json.dumps({v: rows[-1:] for v, rows in old.items()}, indent=2) + '\n')
|
||||
|
||||
if __name__ == '__main__':
|
||||
p = argparse.ArgumentParser()
|
||||
p.add_argument('public', type=Path)
|
||||
p.add_argument('home', type=Path)
|
||||
p.add_argument('key')
|
||||
a = p.parse_args()
|
||||
compact(a.public, a.home, a.key)
|
||||
74
pipeline/compact-storage.py
Normal file
74
pipeline/compact-storage.py
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
#!/usr/bin/env python3
|
||||
"""Offline D-098 maintenance: preserve logs/sources/media, expire build payloads."""
|
||||
import argparse
|
||||
import fcntl
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import shutil
|
||||
import subprocess
|
||||
|
||||
PAYLOADS = {'repo', 'output', 'iso-work', 'profile', 'tools', 'extractor', 'core',
|
||||
'core-base', 'composed', 'layer', 'purpose-stage', 'purpose-layer',
|
||||
'purpose-input', 'flatpak-seed', 'package', 'package-repo', 'private-package-cache'}
|
||||
|
||||
|
||||
def compact(base, worker):
|
||||
base, worker = Path(base), Path(worker)
|
||||
before = {str(p): shutil.disk_usage(p)._asdict() for p in (worker, base / 'data')}
|
||||
locks = []
|
||||
for path in (base / 'data/private/release-cycle/cycle.lock', base / 'data/public/.publish.lock'):
|
||||
stream = path.open('a'); fcntl.flock(stream, fcntl.LOCK_EX | fcntl.LOCK_NB); locks.append(stream)
|
||||
removed = []
|
||||
def remove(path):
|
||||
if not path.exists() and not path.is_symlink():
|
||||
return
|
||||
if path.is_symlink() or path.is_file():
|
||||
path.unlink()
|
||||
else:
|
||||
shutil.rmtree(path)
|
||||
removed.append(str(path))
|
||||
print('Removed ' + str(path), flush=True)
|
||||
# Walk only known project archives and worker runs. Never descend into payloads
|
||||
# or symlinks, and never select generic host/container caches.
|
||||
roots = [base / 'data/private' / name for name in
|
||||
('release-cycle', 'daily', 'gnome', 'layered-release-20261106', 'retained-dbus-024309', 'update-rollout')]
|
||||
roots.append(worker / 'build/release-cycle')
|
||||
for root in roots:
|
||||
for directory, dirs, files in os.walk(root, followlinks=False):
|
||||
path = Path(directory)
|
||||
if path.name == 'build' and path != worker / 'build':
|
||||
for name in PAYLOADS:
|
||||
remove(path / name)
|
||||
remove(path / 'workspace.ext4')
|
||||
dirs[:] = [d for d in dirs if d not in PAYLOADS]
|
||||
for name in files:
|
||||
if name.endswith(('.qcow2', '.raw')):
|
||||
remove(path / name)
|
||||
for cache in (worker / 'cache/flatpak', worker / 'cache/flatpak/kde'):
|
||||
stream = (cache / 'refresh.lock').open('a'); fcntl.flock(stream, fcntl.LOCK_EX | fcntl.LOCK_NB); locks.append(stream)
|
||||
current = (cache / 'current').resolve()
|
||||
for export in (cache / 'exports').iterdir():
|
||||
if export.resolve() != current:
|
||||
remove(export)
|
||||
remove(cache / 'tools') # bootstrap root, recreated by the normal adapter
|
||||
remove(worker / 'diagnostics/dkms-621a8bb/target')
|
||||
public = base / 'data/public'
|
||||
current = (public / 'current').resolve()
|
||||
for generation in (public / '.generations').iterdir():
|
||||
if generation.resolve() != current:
|
||||
remove(generation)
|
||||
subprocess.run(['sync'], check=True)
|
||||
after = {str(p): shutil.disk_usage(p)._asdict() for p in (worker, base / 'data')}
|
||||
report = dict(before=before, after=after, freed_bytes={p: after[p]['free'] - before[p]['free'] for p in before}, removed=removed)
|
||||
print(json.dumps(report, indent=2), flush=True)
|
||||
return report
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument('--base', default='/opt/archipelago')
|
||||
parser.add_argument('--worker', default='/opt/archipelago/worker')
|
||||
parser.add_argument('--report', type=Path, required=True)
|
||||
args = parser.parse_args()
|
||||
args.report.write_text(json.dumps(compact(args.base, args.worker), indent=2) + '\n')
|
||||
|
|
@ -16,22 +16,21 @@ def prepare(config):
|
|||
records = []
|
||||
for item in config['candidates']:
|
||||
root = Path(item['directory'])
|
||||
iso = root / 'build/output' / item['iso_name']
|
||||
iso = root / 'build/output' / item['iso_name'] if item.get('iso_name') else None
|
||||
repo = root / 'build/repo'
|
||||
sha = digest(iso)
|
||||
waiver = None
|
||||
if item.get('vm_acceptance_waiver'):
|
||||
waiver = json.loads(Path(item['vm_acceptance_waiver']).read_text())
|
||||
if waiver.get('authorized_by') != 'user' or not waiver.get('reason') or waiver.get('iso_sha256', {}).get(item['variant']) != sha:
|
||||
raise ValueError('VM acceptance waiver missing or mismatched')
|
||||
if item['variant'] == 'core' and waiver is None:
|
||||
summary = json.loads(Path(item['core_summary']).read_text())
|
||||
if summary.get('passed') is not True or summary.get('iso_sha256') != sha:
|
||||
raise ValueError('Core VM acceptance missing or mismatched')
|
||||
if item.get('native_summary'):
|
||||
summary = json.loads(Path(item['native_summary']).read_text())
|
||||
if summary.get('passed') is not True or summary.get('iso_sha256') != sha:
|
||||
raise ValueError('Native desktop acceptance missing or mismatched')
|
||||
sha = digest(iso) if iso else None
|
||||
rust = item.get('rust_evidence')
|
||||
# D-098: installed-VM acceptance is not part of the cycle. A release is
|
||||
# admitted only through source-bound Rust evidence; boot, firmware and
|
||||
# GUI coverage is declared as a manual user check.
|
||||
if not rust:
|
||||
raise ValueError('D-098 requires frozen-source Rust evidence')
|
||||
evidence = json.loads(Path(rust).read_text())
|
||||
if evidence.get('policy') != 'D-098' or evidence.get('passed') is not True or digest(evidence['source']) != evidence['source_sha256']:
|
||||
raise ValueError('Successful frozen-source Rust evidence required')
|
||||
for check in evidence['checks']:
|
||||
if digest(check['path']) != check['sha256']:
|
||||
raise ValueError('Rust test evidence changed')
|
||||
checks = []
|
||||
for check in item['checks']:
|
||||
path = Path(check['path'])
|
||||
|
|
@ -40,15 +39,15 @@ def prepare(config):
|
|||
checks.append(dict(path=str(path), sha256=digest(path)))
|
||||
def resolve(ref):
|
||||
return subprocess.check_output(['ostree', '--repo=' + str(repo), 'rev-parse', ref], text=True).strip()
|
||||
record = dict(variant=item['variant'], version=item['version'], iso=str(iso), repo=str(repo),
|
||||
record = dict(variant=item['variant'], version=item['version'], iso=str(iso) if iso else None, repo=str(repo),
|
||||
sha256=sha, image_commit=resolve('core'), layer_commit=resolve('layers/core'),
|
||||
acceptance=str(root / 'hardware-test-acceptance.json'))
|
||||
acceptance=str(root / 'release-acceptance.json'))
|
||||
if item['variant'] in ('gnome', 'kde'):
|
||||
record['purpose_layer_commit'] = resolve('layers/purpose/desktop/' + item['variant'])
|
||||
if item.get('expected_image_commit') and record['image_commit'] != item['expected_image_commit']:
|
||||
raise ValueError('Reviewed image differs from repository')
|
||||
Path(record['acceptance']).write_text(json.dumps(record | dict(scope='hardware-test',
|
||||
accepted=True, vm_acceptance='waived-by-user' if waiver else 'passed',
|
||||
Path(record['acceptance']).write_text(json.dumps(record | dict(scope='rust-manual',
|
||||
accepted=True, rust_evidence=rust, vm_acceptance='manual-only',
|
||||
checks=checks, limitations=item.get('limitations', [])), indent=2) + '\n')
|
||||
records.append(record)
|
||||
Path(config['output']).write_text(json.dumps(records, indent=2) + '\n')
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ def publish(public, records, gpg_home=None, gpg_key=None, archives=None, validat
|
|||
if channel not in ('hardware-test', 'testing', 'stable'):
|
||||
raise ValueError('Invalid release channel')
|
||||
if channel != 'hardware-test':
|
||||
identities = [{k: r[k] for k in ('variant', 'version', 'sha256', 'image_commit', 'layer_commit')} for r in records]
|
||||
identities = [{k: r.get(k) for k in ('variant', 'version', 'sha256', 'image_commit', 'layer_commit')} for r in records]
|
||||
if not exception or exception.get('channel') != channel or not exception.get('decision') or not exception.get('reason') or not exception.get('limitations') or sorted(exception.get('candidates', []), key=lambda r: r['variant']) != sorted(identities, key=lambda r: r['variant']):
|
||||
raise ValueError('This interim publisher requires an exact, explicitly approved release exception for production channels')
|
||||
if url_prefix and not re.fullmatch(r'(?:/[A-Za-z0-9_-]+)+', url_prefix):
|
||||
|
|
@ -54,15 +54,15 @@ def publish(public, records, gpg_home=None, gpg_key=None, archives=None, validat
|
|||
raise ValueError('Invalid variant')
|
||||
if not re.fullmatch(r'[A-Za-z0-9][A-Za-z0-9._-]{0,127}', r['version']):
|
||||
raise ValueError('Invalid version')
|
||||
for key in ('sha256', 'image_commit', 'layer_commit'):
|
||||
for key in ('image_commit', 'layer_commit') + (('sha256',) if r.get('iso') else ()):
|
||||
if not re.fullmatch(r'[0-9a-f]{64}', r[key]):
|
||||
raise ValueError('Invalid ' + key)
|
||||
if digest(r['iso']) != r['sha256']:
|
||||
if r.get('iso') and digest(r['iso']) != r['sha256']:
|
||||
raise ValueError('ISO checksum mismatch')
|
||||
acceptance = json.loads(Path(r['acceptance']).read_text())
|
||||
if acceptance.get('scope') != 'hardware-test' or acceptance.get('accepted') is not True:
|
||||
if acceptance.get('scope') not in ('hardware-test', 'rust-manual') or acceptance.get('accepted') is not True:
|
||||
raise ValueError('Explicit hardware-test acceptance required')
|
||||
for key in ('variant', 'version', 'sha256', 'image_commit', 'layer_commit'):
|
||||
for key in ('variant', 'version', 'image_commit', 'layer_commit') + (('sha256',) if r.get('iso') else ()):
|
||||
if acceptance.get(key) != r[key]:
|
||||
raise ValueError('Acceptance identity mismatch: ' + key)
|
||||
if not acceptance.get('checks'):
|
||||
|
|
@ -70,6 +70,12 @@ def publish(public, records, gpg_home=None, gpg_key=None, archives=None, validat
|
|||
for check in acceptance['checks']:
|
||||
if digest(check['path']) != check['sha256']:
|
||||
raise ValueError('Evidence checksum mismatch')
|
||||
if acceptance['scope'] == 'rust-manual':
|
||||
evidence = json.loads(Path(acceptance['rust_evidence']).read_text())
|
||||
if evidence.get('passed') is not True or evidence.get('policy') != 'D-098' or not evidence.get('source_sha256'):
|
||||
raise ValueError('Missing successful source-bound Rust evidence')
|
||||
if not any(c['path'] == acceptance['rust_evidence'] for c in acceptance['checks']):
|
||||
raise ValueError('Rust evidence must be checksum-bound')
|
||||
for key in ('image_commit', 'layer_commit'):
|
||||
ostree(r['repo'], 'show', r[key])
|
||||
linked = ostree(r['repo'], 'show', '--print-metadata-key=archipelago.layer-core', r['image_commit'])
|
||||
|
|
@ -86,6 +92,9 @@ def publish(public, records, gpg_home=None, gpg_key=None, archives=None, validat
|
|||
print(json.dumps({'valid': True, 'variants': [r['variant'] for r in records]}))
|
||||
return
|
||||
public.mkdir(parents=True, exist_ok=True)
|
||||
with_iso = all(bool(r.get('iso')) for r in records)
|
||||
if any(bool(r.get('iso')) for r in records) != with_iso:
|
||||
raise ValueError('Mixed ISO and OSTree-only publication')
|
||||
with (public / '.publish.lock').open('a') as lock:
|
||||
fcntl.flock(lock, fcntl.LOCK_EX | fcntl.LOCK_NB)
|
||||
generations = public / '.generations'
|
||||
|
|
@ -100,10 +109,13 @@ def publish(public, records, gpg_home=None, gpg_key=None, archives=None, validat
|
|||
for directory in ('iso', 'v1', 'ostree'):
|
||||
(stage / directory).mkdir()
|
||||
history = json.loads((previous / 'history.json').read_text()) if previous else {}
|
||||
iso_history_path = previous / 'iso-history.json' if previous else None
|
||||
iso_history = json.loads(iso_history_path.read_text()) if iso_history_path and iso_history_path.exists() else json.loads(json.dumps(history))
|
||||
if set(history) - variants:
|
||||
raise ValueError('Publication must preserve all previously published variants')
|
||||
for variant in variants:
|
||||
history.setdefault(variant, [])
|
||||
iso_history.setdefault(variant, [])
|
||||
for kind in ('images', 'layers'):
|
||||
repo = stage / 'ostree' / kind
|
||||
if previous:
|
||||
|
|
@ -126,35 +138,29 @@ def publish(public, records, gpg_home=None, gpg_key=None, archives=None, validat
|
|||
api_releases = []
|
||||
for r in records:
|
||||
variant = r['variant']
|
||||
entry = {k: r[k] for k in ('version', 'image_commit', 'layer_commit', 'sha256')}
|
||||
entry = {k: r[k] for k in ('version', 'image_commit', 'layer_commit')}
|
||||
if with_iso:
|
||||
entry['sha256'] = r['sha256']
|
||||
entry['channel'] = channel
|
||||
if r.get('purpose_layer_commit'):
|
||||
entry['purpose_layer_commit'] = r['purpose_layer_commit']
|
||||
if exception:
|
||||
entry['release_exception'] = {k: exception[k] for k in ('decision', 'reason', 'limitations')}
|
||||
old = history[variant]
|
||||
if any(e['version'] == r['version'] and any(e.get(k, r[k]) != r[k]
|
||||
if any(e['version'] == r['version'] and any(e.get(k) != r.get(k)
|
||||
for k in ('image_commit', 'layer_commit', 'sha256')) for e in old):
|
||||
raise ValueError('Version identity cannot change')
|
||||
candidates = [e for e in old if e['version'] != r['version']] + [entry]
|
||||
protected = []
|
||||
if channel == 'hardware-test':
|
||||
image_repo = stage / 'ostree/images'
|
||||
existing_refs = set(ostree(image_repo, 'refs').splitlines())
|
||||
production = {ostree(image_repo, 'rev-parse', ref) for ref in
|
||||
('stable/' + variant, 'testing/' + variant) if ref in existing_refs}
|
||||
protected = [e for e in candidates if e['image_commit'] in production]
|
||||
ordinary = [e for e in candidates if e not in protected]
|
||||
history[variant] = protected + ordinary[-(3 - len(protected)):] if len(protected) < 3 else protected[-3:]
|
||||
# D-098: an installed system updates directly to the newest
|
||||
# image, so intermediate image/layer commits are not refs.
|
||||
history[variant] = [entry]
|
||||
if with_iso:
|
||||
iso_history[variant] = ([e for e in iso_history[variant] if e['version'] != r['version']] + [entry])[-3:]
|
||||
if r.get('purpose_layer_commit'):
|
||||
repo = stage / 'ostree/layers'
|
||||
ostree(repo, 'pull-local', '--depth=0', r['repo'], r['purpose_layer_commit'])
|
||||
for ref in ostree(repo, 'refs').splitlines():
|
||||
if ref.startswith('history/purpose/' + variant + '/'):
|
||||
ostree(repo, 'refs', '--delete', ref)
|
||||
for e in history[variant]:
|
||||
if e.get('purpose_layer_commit'):
|
||||
ostree(repo, 'refs', '--create=history/purpose/' + variant + '/' + e['version'], e['purpose_layer_commit'])
|
||||
ostree(repo, 'refs', '--force', '--create=purpose/desktop/' + variant, r['purpose_layer_commit'])
|
||||
for kind, key in (('images', 'image_commit'), ('layers', 'layer_commit')):
|
||||
repo = stage / 'ostree' / kind
|
||||
|
|
@ -162,14 +168,12 @@ def publish(public, records, gpg_home=None, gpg_key=None, archives=None, validat
|
|||
for ref in ostree(repo, 'refs').splitlines():
|
||||
if ref.startswith('history/' + variant + '/'):
|
||||
ostree(repo, 'refs', '--delete', ref)
|
||||
for e in history[variant]:
|
||||
ostree(repo, 'refs', '--create=history/' + variant + '/' + e['version'], e[key])
|
||||
ostree(repo, 'refs', '--force', '--create=' + refs[variant], r[key])
|
||||
for alias in compatibility[variant]:
|
||||
ostree(repo, 'refs', '--force', '--create=' + alias, r[key])
|
||||
name = 'archipelago-' + variant + '.iso'
|
||||
available = []
|
||||
for e in history[variant]:
|
||||
for e in iso_history[variant]:
|
||||
relative = Path('iso') / variant / e['version'] / name
|
||||
target = stage / relative
|
||||
source_record = next((a for a in records + archives
|
||||
|
|
@ -197,7 +201,7 @@ def publish(public, records, gpg_home=None, gpg_key=None, archives=None, validat
|
|||
item = dict(variant=variant, architecture='x86_64', channel=e.get('channel', 'hardware-test'),
|
||||
version=e['version'], sha256=e['sha256'], image_commit=e['image_commit'],
|
||||
layer_commit=e['layer_commit'], size_bytes=target.stat().st_size,
|
||||
current=e['version'] == r['version'],
|
||||
current=e['version'] == iso_history[variant][-1]['version'],
|
||||
url=url_prefix + '/' + relative.as_posix(),
|
||||
checksum_url=url_prefix + '/' + relative.as_posix() + '.sha256')
|
||||
if e.get('release_exception'):
|
||||
|
|
@ -210,17 +214,25 @@ def publish(public, records, gpg_home=None, gpg_key=None, archives=None, validat
|
|||
detail.write_text(json.dumps(dict(apiVersion='archipelago.releases/v1', release=item), indent=2) + '\n')
|
||||
available.reverse()
|
||||
api_releases.extend(available)
|
||||
(stage / 'v1/releases').mkdir(parents=True, exist_ok=True)
|
||||
(stage / 'v1/releases' / (variant + '.json')).write_text(json.dumps(
|
||||
dict(apiVersion='archipelago.releases/v1', releases=available), indent=2) + '\n')
|
||||
os.link(stage / 'iso' / variant / r['version'] / name, stage / 'iso' / name)
|
||||
(stage / 'iso' / (name + '.sha256')).write_text(r['sha256'] + ' ' + name + '\n')
|
||||
if available:
|
||||
latest_iso = available[0]
|
||||
os.link(stage / 'iso' / variant / latest_iso['version'] / name, stage / 'iso' / name)
|
||||
(stage / 'iso' / (name + '.sha256')).write_text(latest_iso['sha256'] + ' ' + name + '\n')
|
||||
# Expose identities/check names, not private evidence paths.
|
||||
(stage / 'v1' / (variant + '.json')).write_text(json.dumps(entry, indent=2) + '\n')
|
||||
releases.append(dict(variant={'core': 'Arch Core', 'gnome': 'GNOME Desktop', 'kde': 'KDE Desktop'}[variant],
|
||||
architecture='x86_64', channel=channel, version=r['version'],
|
||||
sha256=r['sha256'], image_commit=r['image_commit'], url=url_prefix + '/iso/' + name))
|
||||
if exception:
|
||||
releases[-1]['release_exception'] = entry['release_exception']
|
||||
if available:
|
||||
releases.append(dict(latest_iso, variant={'core': 'Arch Core', 'gnome': 'GNOME Desktop', 'kde': 'KDE Desktop'}[variant],
|
||||
url=url_prefix + '/iso/' + name))
|
||||
# D-098: ISO embeds its own repository. Public OSTree retains only
|
||||
# current images/layers, never historical ISO bases.
|
||||
for kind in ('images', 'layers'):
|
||||
repo = stage / 'ostree' / kind
|
||||
for ref in ostree(repo, 'refs').splitlines():
|
||||
if ref.startswith(('iso-history/', 'history/')):
|
||||
ostree(repo, 'refs', '--delete', ref)
|
||||
for kind in ('images', 'layers'):
|
||||
repo = stage / 'ostree' / kind
|
||||
ostree(repo, 'prune', '--refs-only', '--depth=0')
|
||||
|
|
@ -236,6 +248,7 @@ def publish(public, records, gpg_home=None, gpg_key=None, archives=None, validat
|
|||
else:
|
||||
ostree(repo, 'summary', '--update')
|
||||
(stage / 'history.json').write_text(json.dumps(history, indent=2) + '\n')
|
||||
(stage / 'iso-history.json').write_text(json.dumps(iso_history, indent=2) + '\n')
|
||||
(stage / 'publication-refs.json').write_text(json.dumps(refs, indent=2) + '\n')
|
||||
(stage / 'compatibility-refs.json').write_text(json.dumps(compatibility, indent=2) + '\n')
|
||||
(stage / 'v1/releases.json').write_text(json.dumps(dict(
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
#!/usr/bin/env python3
|
||||
"""Bounded daily Core -> GNOME -> installed-VM checks -> signed publication.
|
||||
|
||||
This driver publishes stable under the explicit daily authorization D-087.
|
||||
Outstanding admission evidence remains recorded; D-079 is not reused.
|
||||
"""
|
||||
"""D-098: Rust checks, Core/Purpose composition, signed OSTree; ISO on day 30."""
|
||||
import argparse
|
||||
from datetime import datetime, timezone
|
||||
import fcntl
|
||||
|
|
@ -60,17 +56,9 @@ def write_status(base, state):
|
|||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument('--config', default=os.environ.get('ARCHIPELAGO_CYCLE_CONFIG', '/etc/archipelago/release-cycle.json'))
|
||||
parser.add_argument('--existing', help='JSON mapping core/gnome to existing worker build directories')
|
||||
parser.add_argument('--archive', type=Path, help='Reuse matching archived inputs; seed delta transfer when rebuilding Purpose')
|
||||
parser.add_argument('--core-build', help='Reuse a completed worker Core build; rebuild only Purpose and repeat both VM checks')
|
||||
parser.add_argument('--vm-acceptance-waiver', type=Path, help='Explicit one-run user authorization bound to existing ISO hashes')
|
||||
parser.add_argument('--mode', choices=('auto', 'ostree', 'iso'), default='auto')
|
||||
args = parser.parse_args()
|
||||
if args.core_build and (args.existing or not Path(args.core_build).is_absolute()):
|
||||
parser.error('--core-build requires an absolute path and cannot accompany --existing')
|
||||
if args.archive and (not (args.existing or args.core_build) or not args.archive.is_absolute()):
|
||||
parser.error('--archive requires --existing or --core-build and an absolute coordinator path')
|
||||
if args.vm_acceptance_waiver and not (args.existing and args.archive):
|
||||
parser.error('--vm-acceptance-waiver requires --existing and --archive')
|
||||
mode = args.mode if args.mode != 'auto' else ('iso' if datetime.now(timezone.utc).day == 30 else 'ostree')
|
||||
config = json.loads(Path(args.config).read_text())
|
||||
variants = tuple(config.get('variants', ['core', 'gnome']))
|
||||
if variants not in (('core', 'gnome'), ('core', 'gnome', 'kde')):
|
||||
|
|
@ -101,9 +89,9 @@ def main():
|
|||
worker = config['worker']
|
||||
remote_root = config['worker_root'] + '/build/release-cycle/' + stamp
|
||||
state = dict(version=1, run=stamp, started=datetime.now(timezone.utc).isoformat(),
|
||||
state='starting', published=False, channel='stable',
|
||||
state='starting', published=False, channel='stable', output_mode=mode,
|
||||
invocation_id=os.environ.get('INVOCATION_ID'), worker=worker,
|
||||
reason=os.environ.get('ARCHIPELAGO_RELEASE_REASON', 'Daily release cycle'))
|
||||
reason=os.environ.get('ARCHIPELAGO_RELEASE_REASON', 'D-098 Rust/manual release cycle'))
|
||||
step = 0
|
||||
worker_units = []
|
||||
titles = status_module.TITLES
|
||||
|
|
@ -130,7 +118,7 @@ def main():
|
|||
'--mount', f'type=bind,src={run}/pipeline,dst=/pipeline,readonly']
|
||||
if signing:
|
||||
mounts += ['--mount', f'type=bind,src={config["signing_home"]},dst=/signing']
|
||||
return ['docker', 'run', '--rm', '--network=none', '--env', 'ARCHIPELAGO_RELEASE_REASON',
|
||||
return ['docker', 'run', '--rm', '--label', 'archipelago.release-run=' + stamp, '--network=none', '--env', 'ARCHIPELAGO_RELEASE_REASON',
|
||||
*mounts, config['coordinator_tools_image'], *map(str, argv)]
|
||||
def retain_logs():
|
||||
roots = {'worker': Path(remote_root), 'archive': run}
|
||||
|
|
@ -150,47 +138,6 @@ def main():
|
|||
signal.signal(signal.SIGTERM, interrupted)
|
||||
signal.signal(signal.SIGINT, interrupted)
|
||||
builds = None
|
||||
vm_unit = 'archipelago-cycle-gnome-' + stamp
|
||||
kde_vm_unit = 'archipelago-cycle-kde-' + stamp
|
||||
def validate_pair():
|
||||
for variant in variants:
|
||||
(run / variant).mkdir(exist_ok=True)
|
||||
if not args.existing:
|
||||
remote('\n'.join('rm -rf ' + ' '.join(shlex.quote(builds[v] + '/' + name) for name in
|
||||
('iso-work', 'profile', 'extractor', 'tools', 'core', 'layer', 'composed', 'core-base', 'flatpak-seed'))
|
||||
for v in (desktops if args.core_build else variants)))
|
||||
phase('core-installed-acceptance')
|
||||
remote(f'''mkdir -p {remote_root}/core/vms
|
||||
python3 {remote_root}/probes/core_iso_acceptance.py --iso {shlex.quote(builds['core'])}/output/archipelago-core-latest.iso --workdir {remote_root}/core/vms --production-cli --extensions-sequence --firmware --ovmf-code {shlex.quote(config['ovmf_code'])} --ovmf-vars {shlex.quote(config['ovmf_vars'])} > {remote_root}/core/acceptance.log 2>&1''', 14400)
|
||||
call(['rsync', '-a', '--include=*/', '--include=*.json', '--include=*.jsonl', '--include=*.serial', '--exclude=*',
|
||||
f'{worker}:{remote_root}/core/vms/', str(run / 'core/vms') + '/'])
|
||||
call(['rsync', '-a', f'{worker}:{remote_root}/core/acceptance.log', str(run / 'core') + '/'])
|
||||
remote(f'find {remote_root}/core/vms -name core.qcow2 -type f -delete')
|
||||
phase('gnome-installed-acceptance')
|
||||
remote(shlex.join(['python3', remote_root + '/probes/gnome_native_acceptance.py',
|
||||
'--iso', builds['gnome'] + '/output/archipelago-gnome-probe.iso',
|
||||
'--workdir', remote_root + '/gnome/acceptance', '--unit', vm_unit,
|
||||
'--ovmf-code', config['ovmf_code'], '--ovmf-vars', config['ovmf_vars']]), 14400)
|
||||
call(['rsync', '-a', '--include=*/', '--include=*.json', '--include=*.log', '--include=*.serial',
|
||||
'--include=*.png', '--exclude=*', f'{worker}:{remote_root}/gnome/acceptance/', str(run / 'gnome/acceptance') + '/'])
|
||||
remote('systemctl stop ' + shlex.quote(vm_unit))
|
||||
if 'kde' in desktops:
|
||||
phase('kde-installed-acceptance')
|
||||
command = ['python3', remote_root + '/probes/gnome_native_acceptance.py', '--variant', 'kde',
|
||||
'--iso', builds['kde'] + '/output/' + iso_name('kde'),
|
||||
'--workdir', remote_root + '/kde/acceptance', '--unit', kde_vm_unit,
|
||||
'--ssh-port', '22297', '--ovmf-code', config['ovmf_code'], '--ovmf-vars', config['ovmf_vars']]
|
||||
if config.get('kde_ui_actions'):
|
||||
action_path = Path(config['kde_ui_actions'])
|
||||
if action_path.is_absolute() or '..' in action_path.parts:
|
||||
raise ValueError('KDE UI profile must be a frozen source-relative path')
|
||||
command += ['--ui-actions', remote_root + '/source/src/' + str(action_path)]
|
||||
if config.get('kde_ui_calibration'):
|
||||
command += ['--calibrate-ui']
|
||||
remote(shlex.join(command), 14400)
|
||||
call(['rsync', '-a', '--include=*/', '--include=*.json', '--include=*.log', '--include=*.serial',
|
||||
'--include=*.png', '--exclude=*', f'{worker}:{remote_root}/kde/acceptance/', str(run / 'kde/acceptance') + '/'])
|
||||
remote('systemctl stop ' + shlex.quote(kde_vm_unit))
|
||||
try:
|
||||
if previous and previous.get('state') != 'complete':
|
||||
old_id = previous['run']
|
||||
|
|
@ -212,7 +159,7 @@ python3 {remote_root}/probes/core_iso_acceptance.py --iso {shlex.quote(builds['c
|
|||
atomic(old_path, old)
|
||||
phase('preflight')
|
||||
atomic(run / 'private-cleanup.json', {'removed': cleanup_module.cleanup(parent, stamp)})
|
||||
remote(f'mkdir -p {shlex.quote(remote_root)}; test -c /dev/kvm; command -v qemu-system-x86_64; python3 -c "import pexpect"; test -f {shlex.quote(config["worker_source_root"])}/src/rfc/schemas/layer-v1.schema.json')
|
||||
remote(f'mkdir -p {shlex.quote(remote_root)}; test -f {shlex.quote(config["worker_source_root"])}/src/rfc/schemas/layer-v1.schema.json')
|
||||
# Compile from the frozen source tree, not a possibly stale deployed CLI.
|
||||
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
|
||||
|
|
@ -223,21 +170,15 @@ mkdir -p {shlex.quote(config['worker_source_root'])}/target {shlex.quote(config[
|
|||
docker run --rm --network=none --mount type=bind,src={remote_root}/source/src,dst=/build/src,readonly --mount type=bind,src={shlex.quote(config['worker_source_root'])}/target,dst=/build/target --mount type=bind,src={shlex.quote(config['worker_root'])}/cache/cargo,dst=/usr/local/cargo/registry {shlex.quote(config['worker_tools_image'])} cargo build --manifest-path /build/src/cli/Cargo.toml --offline --locked --release
|
||||
cp {shlex.quote(config['worker_source_root'])}/target/release/archipelago {remote_root}/archipelago
|
||||
cp {shlex.quote(config['worker_source_root'])}/target/release/archipelagod {remote_root}/archipelagod
|
||||
docker run --rm --network=none --mount type=bind,src={remote_root}/source/src,dst=/build/src,readonly --mount type=bind,src={shlex.quote(config['worker_source_root'])}/target,dst=/build/target --mount type=bind,src={shlex.quote(config['worker_root'])}/cache/cargo,dst=/usr/local/cargo/registry {shlex.quote(config['worker_tools_image'])} cargo test --manifest-path /build/src/cli/Cargo.toml --offline --locked --release -p archipelago-system -p archipelago-contracts -p archipelago-composer > {remote_root}/service-contract-checks.log 2>&1
|
||||
docker run --rm --network=none --mount type=bind,src={remote_root}/source/src,dst=/build/src,readonly {shlex.quote(config['worker_tools_image'])} python3 /build/src/system/tests/kernel_arguments.py >> {remote_root}/service-contract-checks.log 2>&1
|
||||
python3 {remote_root}/source/src/composer/tests/materialize.py > {remote_root}/composer-filesystem-checks.log 2>&1
|
||||
python3 {remote_root}/source/src/composer/tests/artifact.py >> {remote_root}/composer-filesystem-checks.log 2>&1
|
||||
python3 {remote_root}/source/src/composer/tests/package_db.py >> {remote_root}/composer-filesystem-checks.log 2>&1
|
||||
python3 {remote_root}/source/src/composer/tests/base.py >> {remote_root}/composer-filesystem-checks.log 2>&1
|
||||
python3 {remote_root}/source/src/builder/tests/indexed_overlay.py >> {remote_root}/composer-filesystem-checks.log 2>&1
|
||||
docker run --rm --network=none --mount type=bind,src={remote_root}/source/src,dst=/build/src,readonly --mount type=bind,src={shlex.quote(config['worker_source_root'])}/target,dst=/build/target --mount type=bind,src={shlex.quote(config['worker_root'])}/cache/cargo,dst=/usr/local/cargo/registry {shlex.quote(config['worker_tools_image'])} cargo test --manifest-path /build/src/cli/Cargo.toml --offline --locked --release -p archipelago -p archipelago-system -p archipelago-contracts -p archipelago-composer -p archipelago-builder -p archipelago-installer -p archipelago-registry > {remote_root}/service-contract-checks.log 2>&1
|
||||
python3 {remote_root}/source/src/infrastructure/tests/control_portal.py > {remote_root}/control-portal-checks.log 2>&1
|
||||
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''')
|
||||
call(['rsync', '-a', f'{worker}:{remote_root}/service-contract-checks.log', str(run / 'service-contract-checks.log')])
|
||||
call(['rsync', '-a', f'{worker}:{remote_root}/composer-filesystem-checks.log', str(run / 'composer-filesystem-checks.log')])
|
||||
if config.get('flatpak_cache') and not args.existing:
|
||||
call(['rsync', '-a', f'{worker}:{remote_root}/control-portal-checks.log', str(run / 'control-portal-checks.log')])
|
||||
if config.get('flatpak_cache'):
|
||||
remote(f'test "$(df -PB1 {remote_root} | awk \'NR==2 {{print $4}}\')" -ge {config.get("minimum_build_free_bytes", 60000000000)}')
|
||||
phase('updating-flatpak-cache')
|
||||
refresh = int(config.get('flatpak_refresh_seconds', 14400))
|
||||
|
|
@ -264,74 +205,57 @@ find {remote_root}/probes -type f -name '*.py' -exec sha256sum {{}} + >> {remote
|
|||
' > ' + shlex.quote(remote_root + '/flatpak-kde.log') + ' 2>&1', 14400)
|
||||
call(['rsync', '-a', f'{worker}:{kde_cache}/status.json', str(run / 'flatpak-kde-status.json')])
|
||||
state['flatpak_kde'] = json.loads((run / 'flatpak-kde-status.json').read_text())
|
||||
if args.existing:
|
||||
builds = json.loads(Path(args.existing).read_text())
|
||||
if set(builds) != set(variants) or any(not Path(x).is_absolute() for x in builds.values()):
|
||||
raise ValueError('Existing inputs must name absolute paths for every configured variant')
|
||||
atomic(run / 'existing-inputs.json', builds)
|
||||
else:
|
||||
phase('building-software-adapter')
|
||||
remote(shlex.join(['bash', remote_root + '/source/src/infrastructure/pipeline/build-software-adapter.sh',
|
||||
phase('building-software-adapter')
|
||||
remote(shlex.join(['bash', remote_root + '/source/src/infrastructure/pipeline/build-software-adapter.sh',
|
||||
remote_root + '/source/src', config['flatpak_cache'] + '/tools/root.x86_64',
|
||||
config['build_environment']['ARCHIPELAGO_PACKAGE_CACHE'], remote_root + '/software-adapter']) +
|
||||
' > ' + shlex.quote(remote_root + '/software-adapter.log') + ' 2>&1', 14400)
|
||||
call(['rsync', '-a', f'{worker}:{remote_root}/software-adapter/', str(run / 'software-adapter') + '/'])
|
||||
if 'kde' in desktops:
|
||||
phase('building-discover-adapter')
|
||||
remote(shlex.join(['bash', remote_root + '/source/src/infrastructure/pipeline/build-discover-adapter.sh',
|
||||
remote_root + '/source/src', config['flatpak_cache'] + '/tools/root.x86_64',
|
||||
config['build_environment']['ARCHIPELAGO_PACKAGE_CACHE'], remote_root + '/software-adapter']) +
|
||||
' > ' + shlex.quote(remote_root + '/software-adapter.log') + ' 2>&1', 14400)
|
||||
call(['rsync', '-a', f'{worker}:{remote_root}/software-adapter/', str(run / 'software-adapter') + '/'])
|
||||
if 'kde' in desktops:
|
||||
phase('building-discover-adapter')
|
||||
remote(shlex.join(['bash', remote_root + '/source/src/infrastructure/pipeline/build-discover-adapter.sh',
|
||||
remote_root + '/source/src', config['flatpak_cache'] + '/tools/root.x86_64',
|
||||
config['build_environment']['ARCHIPELAGO_PACKAGE_CACHE'], remote_root + '/discover-adapter']) +
|
||||
' > ' + shlex.quote(remote_root + '/discover-adapter.log') + ' 2>&1', 14400)
|
||||
call(['rsync', '-a', f'{worker}:{remote_root}/discover-adapter/', str(run / 'discover-adapter') + '/'])
|
||||
phase('building-core')
|
||||
builds = {v: remote_root + '/' + v + '/build' for v in variants}
|
||||
build_env = dict(config['build_environment'], ARCHIPELAGO_SOFTWARE_PLUGIN=remote_root + '/software-adapter/libgs_plugin_archipelago.so',
|
||||
ARCHIPELAGO_LOG_DIR=remote_root + '/cli-logs')
|
||||
if 'kde' in desktops:
|
||||
build_env['ARCHIPELAGO_PLASMA_SETUP_PACKAGE'] = remote_root + '/discover-adapter/plasma-setup-6.8.2-1-x86_64.pkg.tar.zst'
|
||||
if 'kde' in desktops and build_env.get('ARCHIPELAGO_UPDATE_PROFILE'):
|
||||
original_profile = build_env['ARCHIPELAGO_UPDATE_PROFILE']
|
||||
generated_profile = remote_root + '/update.json'
|
||||
remote(shlex.join(['python3', '-c',
|
||||
'import json,sys; p=json.load(open(sys.argv[1])); '
|
||||
'assert p["version"] == 1; '
|
||||
'p["refs"].setdefault("kde", "stable/kde"); '
|
||||
'open(sys.argv[2], "w").write(json.dumps(p, indent=2)+"\\n")',
|
||||
original_profile, generated_profile]))
|
||||
build_env['ARCHIPELAGO_UPDATE_PROFILE'] = generated_profile
|
||||
env = 'env ' + ' '.join(shlex.quote(k + '=' + v) for k, v in build_env.items())
|
||||
if args.core_build:
|
||||
builds['core'] = args.core_build
|
||||
atomic(run / 'reused-core-build.json', {'path': args.core_build})
|
||||
remote(f'mkdir -p {remote_root}/gnome; test -s {shlex.quote(args.core_build)}/output/SHA256SUMS')
|
||||
else:
|
||||
remote(f'''test "$(df -PB1 {remote_root} | awk 'NR==2 {{print $4}}')" -ge {config.get('minimum_build_free_bytes', 60000000000)}
|
||||
config['build_environment']['ARCHIPELAGO_PACKAGE_CACHE'], remote_root + '/discover-adapter']) +
|
||||
' > ' + shlex.quote(remote_root + '/discover-adapter.log') + ' 2>&1', 14400)
|
||||
call(['rsync', '-a', f'{worker}:{remote_root}/discover-adapter/', str(run / 'discover-adapter') + '/'])
|
||||
phase('building-core')
|
||||
builds = {v: remote_root + '/' + v + '/build' for v in variants}
|
||||
build_env = dict(config['build_environment'], ARCHIPELAGO_SOFTWARE_PLUGIN=remote_root + '/software-adapter/libgs_plugin_archipelago.so',
|
||||
ARCHIPELAGO_BUILD_OUTPUT=mode,
|
||||
ARCHIPELAGO_LOG_DIR=remote_root + '/cli-logs')
|
||||
if 'kde' in desktops:
|
||||
build_env['ARCHIPELAGO_PLASMA_SETUP_PACKAGE'] = remote_root + '/discover-adapter/plasma-setup-6.8.2-1-x86_64.pkg.tar.zst'
|
||||
if 'kde' in desktops and build_env.get('ARCHIPELAGO_UPDATE_PROFILE'):
|
||||
original_profile = build_env['ARCHIPELAGO_UPDATE_PROFILE']
|
||||
generated_profile = remote_root + '/update.json'
|
||||
remote(shlex.join(['python3', '-c',
|
||||
'import json,sys; p=json.load(open(sys.argv[1])); '
|
||||
'assert p["version"] == 1; '
|
||||
'p["refs"].setdefault("kde", "stable/kde"); '
|
||||
'open(sys.argv[2], "w").write(json.dumps(p, indent=2)+"\\n")',
|
||||
original_profile, generated_profile]))
|
||||
build_env['ARCHIPELAGO_UPDATE_PROFILE'] = generated_profile
|
||||
env = 'env ' + ' '.join(shlex.quote(k + '=' + v) for k, v in build_env.items())
|
||||
remote(f'''test "$(df -PB1 {remote_root} | awk 'NR==2 {{print $4}}')" -ge {config.get('minimum_build_free_bytes', 60000000000)}
|
||||
mkdir -p {remote_root}/core {remote_root}/gnome
|
||||
{env} {remote_root}/archipelago build iso {builds['core']} {shlex.quote(config['bootstrap'])} > {remote_root}/core/build.log 2>&1
|
||||
rm -rf {builds['core']}/iso-work {builds['core']}/profile {builds['core']}/extractor {builds['core']}/tools {builds['core']}/composed {builds['core']}/layer''', 14400)
|
||||
phase('building-gnome-purpose-and-iso')
|
||||
remote(f'{env} ARCHIPELAGO_CORE_BUILD={builds["core"]} {remote_root}/archipelago build iso --purpose gnome {builds["gnome"]} {shlex.quote(config["bootstrap"])} > {remote_root}/gnome/build.log 2>&1', 14400)
|
||||
if 'kde' in desktops:
|
||||
phase('building-kde-purpose-and-iso')
|
||||
remote('rm -rf ' + ' '.join(shlex.quote(builds['gnome'] + '/' + name) for name in
|
||||
('iso-work', 'profile', 'extractor', 'tools', 'core', 'layer', 'composed', 'core-base', 'flatpak-seed')))
|
||||
kde_env = dict(build_env,
|
||||
ARCHIPELAGO_DISCOVER_PLUGIN=remote_root + '/discover-adapter/archipelago-backend.so',
|
||||
ARCHIPELAGO_FLATPAK_SEED=config['kde_flatpak_cache'] + '/current',
|
||||
ARCHIPELAGO_FLATPAK_POLICY=remote_root + '/source/src/purposes/proposals/kde-flatpak-apps.json')
|
||||
kde_env.pop('ARCHIPELAGO_SOFTWARE_PLUGIN', None)
|
||||
kde_command = shlex.join(['env', *[k + '=' + v for k, v in kde_env.items()],
|
||||
'ARCHIPELAGO_CORE_BUILD=' + builds['core'], remote_root + '/archipelago',
|
||||
'build', 'iso', '--purpose', 'kde', builds['kde'], config['bootstrap']])
|
||||
remote(f'mkdir -p {remote_root}/kde; {kde_command} > {remote_root}/kde/build.log 2>&1', 14400)
|
||||
if args.vm_acceptance_waiver:
|
||||
waiver = json.loads(args.vm_acceptance_waiver.read_text())
|
||||
if waiver.get('authorized_by') != 'user' or not waiver.get('reason') or set(waiver.get('iso_sha256', {})) != set(variants):
|
||||
raise ValueError('Invalid explicit VM acceptance waiver')
|
||||
atomic(run / 'vm-acceptance-waiver.json', waiver)
|
||||
state['vm_acceptance'] = {'state': 'waived-by-user', 'reason': waiver['reason']}
|
||||
else:
|
||||
validate_pair()
|
||||
phase('building-gnome-purpose-and-iso')
|
||||
remote(f'{env} ARCHIPELAGO_CORE_BUILD={builds["core"]} {remote_root}/archipelago build iso --purpose gnome {builds["gnome"]} {shlex.quote(config["bootstrap"])} > {remote_root}/gnome/build.log 2>&1', 14400)
|
||||
if 'kde' in desktops:
|
||||
phase('building-kde-purpose-and-iso')
|
||||
remote('rm -rf ' + ' '.join(shlex.quote(builds['gnome'] + '/' + name) for name in
|
||||
('iso-work', 'profile', 'extractor', 'tools', 'core', 'layer', 'composed', 'core-base', 'flatpak-seed')))
|
||||
kde_env = dict(build_env,
|
||||
ARCHIPELAGO_DISCOVER_PLUGIN=remote_root + '/discover-adapter/archipelago-backend.so',
|
||||
ARCHIPELAGO_FLATPAK_SEED=config['kde_flatpak_cache'] + '/current',
|
||||
ARCHIPELAGO_FLATPAK_POLICY=remote_root + '/source/src/purposes/proposals/kde-flatpak-apps.json')
|
||||
kde_env.pop('ARCHIPELAGO_SOFTWARE_PLUGIN', None)
|
||||
kde_command = shlex.join(['env', *[k + '=' + v for k, v in kde_env.items()],
|
||||
'ARCHIPELAGO_CORE_BUILD=' + builds['core'], remote_root + '/archipelago',
|
||||
'build', 'iso', '--purpose', 'kde', builds['kde'], config['bootstrap']])
|
||||
remote(f'mkdir -p {remote_root}/kde; {kde_command} > {remote_root}/kde/build.log 2>&1', 14400)
|
||||
state['vm_acceptance'] = {'state': 'manual-only', 'policy': 'D-098'}
|
||||
phase('archiving-artifacts')
|
||||
if shutil.disk_usage(base / 'data').free < config.get('minimum_coordinator_free_bytes', 50000000000):
|
||||
raise ValueError('Insufficient coordinator space for artifact archive and publication')
|
||||
|
|
@ -340,86 +264,43 @@ rm -rf {builds['core']}/iso-work {builds['core']}/profile {builds['core']}/extra
|
|||
dest.mkdir(parents=True)
|
||||
# Stream immutable completed trees: rsync's per-file round trips are
|
||||
# disproportionately expensive for OSTree's many small objects.
|
||||
if args.archive and (args.existing or variant == 'core'):
|
||||
archived = args.archive / variant / 'build'
|
||||
names = ['output/' + iso_name(variant),
|
||||
'repo/refs/heads/core', 'repo/refs/heads/layers/core']
|
||||
if variant in desktops:
|
||||
names.append('repo/refs/heads/layers/purpose/desktop/' + variant)
|
||||
expected = []
|
||||
for name in names:
|
||||
with (archived / name).open('rb') as stream:
|
||||
expected.append(hashlib.file_digest(stream, 'sha256').hexdigest())
|
||||
actual = observer.call(['ssh', '-o', 'BatchMode=yes', '-o', 'ConnectTimeout=20', worker,
|
||||
'cd ' + shlex.quote(builds[variant]) + ' && ' + shlex.join(['sha256sum', *names])],
|
||||
capture=True, timeout=300)
|
||||
if [line.split()[0] for line in actual.splitlines()] != expected:
|
||||
raise ValueError('Archived ISO or refs differ from worker: ' + variant)
|
||||
for part in ('repo', 'output', 'evidence'):
|
||||
call(['cp', '-a', '--reflink=auto', archived / part, dest])
|
||||
atomic(run / (variant + '-archive-reuse.json'), {'archive': str(archived), 'files': dict(zip(names, expected))})
|
||||
elif args.archive:
|
||||
# Seed from prior immutable bytes, then transfer only differences.
|
||||
# Checksums (not mtime) decide reuse; delete stale refs/files only
|
||||
# in this new run's private copy. fsck below validates the result.
|
||||
archived = args.archive / variant / 'build'
|
||||
for part in ('repo', 'output', 'evidence'):
|
||||
call(['cp', '-a', '--reflink=auto', archived / part, dest])
|
||||
call(['rsync', '-a', '--checksum', '--delete',
|
||||
f'{worker}:{builds[variant]}/{part}/', str(dest / part) + '/'])
|
||||
else:
|
||||
transfer = shlex.join(['ssh', '-o', 'BatchMode=yes', '-o', 'ConnectTimeout=20', worker,
|
||||
shlex.join(['tar', '-C', builds[variant], '-cf', '-', 'repo', 'output', 'evidence'])])
|
||||
call(['bash', '-o', 'pipefail', '-c', transfer + ' | ' +
|
||||
shlex.join(['tar', '-C', str(dest), '-xf', '-'])])
|
||||
transfer = shlex.join(['ssh', '-o', 'BatchMode=yes', '-o', 'ConnectTimeout=20', worker,
|
||||
shlex.join(['tar', '-C', builds[variant], '-cf', '-', 'repo', 'output', 'evidence'])])
|
||||
call(['bash', '-o', 'pipefail', '-c', transfer + ' | ' +
|
||||
shlex.join(['tar', '-C', str(dest), '-xf', '-'])])
|
||||
call(tools(['ostree', '--repo=' + str(dest / 'repo'), 'fsck']))
|
||||
state['artifacts_archived'] = True
|
||||
call(['rsync', '-a', f'{worker}:{remote_root}/inputs.sha256', str(run) + '/'])
|
||||
call(['rsync', '-a', f'{worker}:{remote_root}/source.tar', f'{worker}:{remote_root}/archipelago', str(run) + '/'])
|
||||
if not args.existing:
|
||||
call(['rsync', '-a', f'{worker}:{remote_root}/cli-logs/', str(run / 'cli-logs') + '/'])
|
||||
call(['rsync', '-a', f'{worker}:{remote_root}/cli-logs/', str(run / 'cli-logs') + '/'])
|
||||
phase('preparing-publication')
|
||||
core_summaries = list((run / 'core/vms').glob('*/summary.json'))
|
||||
if not args.vm_acceptance_waiver and len(core_summaries) != 1:
|
||||
raise ValueError('Missing or ambiguous Core acceptance')
|
||||
review = {'output': str(run / 'candidates.json'), 'candidates': [
|
||||
dict(variant='core', version=stamp, directory=str(run / 'core'), iso_name='archipelago-core-latest.iso',
|
||||
core_summary=str(core_summaries[0]) if core_summaries else '', checks=[{'path': str(core_summaries[0])}] if core_summaries else []),
|
||||
dict(variant='gnome', version=stamp, directory=str(run / 'gnome'), iso_name='archipelago-gnome-probe.iso',
|
||||
native_summary=str(run / 'gnome/acceptance/native-acceptance.json'),
|
||||
checks=[{'path': str(run / 'gnome/acceptance/native-acceptance.json')},
|
||||
{'path': str(run / 'gnome/acceptance/guest.log')}]) ]}
|
||||
for item in review['candidates']:
|
||||
item['limitations'] = ['Daily stable publication authorized by D-087; outstanding admission evidence remains open',
|
||||
'General Managed Overlay release gate, full reproducibility and GUI OS-update acceptance remain open']
|
||||
if 'kde' in desktops:
|
||||
review['candidates'].append(dict(variant='kde', version=stamp, directory=str(run / 'kde'),
|
||||
iso_name=iso_name('kde'), native_summary=str(run / 'kde/acceptance/native-acceptance.json'),
|
||||
checks=[{'path': str(run / 'kde/acceptance/native-acceptance.json')},
|
||||
{'path': str(run / 'kde/acceptance/guest.log')}],
|
||||
limitations=['Private KDE candidate; D-089 selects product direction, not public release admission',
|
||||
'First-image UI calibration does not prove autonomous onboarding acceptance',
|
||||
*review['candidates'][0]['limitations'][1:]]))
|
||||
if args.vm_acceptance_waiver:
|
||||
for item in review['candidates']:
|
||||
item.pop('core_summary', None)
|
||||
item.pop('native_summary', None)
|
||||
item['vm_acceptance_waiver'] = str(run / 'vm-acceptance-waiver.json')
|
||||
item['checks'] = [{'path': str(run / 'vm-acceptance-waiver.json')}]
|
||||
item['limitations'].append('VM acceptance waived by explicit user authorization for this publication: ' + waiver['reason'])
|
||||
def digest(path):
|
||||
with Path(path).open('rb') as stream:
|
||||
return hashlib.file_digest(stream, 'sha256').hexdigest()
|
||||
evidence = run / 'rust-evidence.json'
|
||||
atomic(evidence, dict(policy='D-098', passed=True, source=str(run / 'source.tar'),
|
||||
source_sha256=digest(run / 'source.tar'),
|
||||
checks=[dict(path=str(run / name), sha256=digest(run / name)) for name in
|
||||
('service-contract-checks.log', 'control-portal-checks.log')]))
|
||||
review = {'output': str(run / 'candidates.json'), 'candidates': [dict(
|
||||
variant=v, version=stamp, directory=str(run / v),
|
||||
iso_name=iso_name(v) if mode == 'iso' else None,
|
||||
rust_evidence=str(evidence), checks=[{'path': str(evidence)}],
|
||||
limitations=['D-098: boot, hardware and GUI scenarios are user manual checks; no VM acceptance',
|
||||
'Rust and adapter checks do not establish full bitwise reproducibility']) for v in variants]}
|
||||
atomic(run / 'review.json', review)
|
||||
call(tools(['python3', '/pipeline/prepare-hardware-pair.py', run / 'review.json']))
|
||||
records = json.loads((run / 'candidates.json').read_text())
|
||||
publish_variants = variants if config.get('kde_release_decision') else ('core', 'gnome')
|
||||
publication_records = [r for r in records if r['variant'] in publish_variants]
|
||||
atomic(run / 'publication-candidates.json', publication_records)
|
||||
state['private_candidates'] = [{k: r[k] for k in ('variant', 'version', 'sha256', 'image_commit', 'layer_commit')}
|
||||
state['private_candidates'] = [{k: r.get(k) for k in ('variant', 'version', 'sha256', 'image_commit', 'layer_commit')}
|
||||
for r in records if r['variant'] not in publish_variants]
|
||||
atomic(run / 'release-authorization.json', {
|
||||
'channel': 'stable', 'decision': config['kde_release_decision'] if 'kde' in publish_variants else 'D-087',
|
||||
'reason': waiver['reason'] if args.vm_acceptance_waiver else 'Explicit user authorization for daily stable publication and installed-ISO update continuity',
|
||||
'channel': 'stable', 'decision': 'D-098',
|
||||
'reason': 'User-approved Rust/manual policy and separate OSTree/ISO cadence',
|
||||
'limitations': review['candidates'][0]['limitations'],
|
||||
'candidates': [{k: r[k] for k in ('variant', 'version', 'sha256', 'image_commit', 'layer_commit')}
|
||||
'candidates': [{k: r.get(k) for k in ('variant', 'version', 'sha256', 'image_commit', 'layer_commit')}
|
||||
for r in publication_records]})
|
||||
phase('signing-and-publishing')
|
||||
call(tools(['python3', '/pipeline/publish-hardware.py', base / 'data/public', run / 'publication-candidates.json',
|
||||
|
|
@ -429,40 +310,31 @@ rm -rf {builds['core']}/iso-work {builds['core']}/profile {builds['core']}/extra
|
|||
(['--kde-ref', 'stable/kde'] if 'kde' in publish_variants else []), True))
|
||||
phase('verifying-public-endpoints', published=True)
|
||||
url = config['public_url'].rstrip('/')
|
||||
with urllib.request.urlopen(url + '/v1/releases.json', timeout=60) as response:
|
||||
releases = json.load(response)['releases']
|
||||
current = [r for r in releases if r['current']]
|
||||
if {r['variant'] for r in current} != set(publish_variants) or len(current) != len(publish_variants) or any(r['version'] != stamp for r in current):
|
||||
raise ValueError('Published catalog does not match this cycle')
|
||||
for item in current:
|
||||
address = url.split('/archipelago')[0] + item['url']
|
||||
with urllib.request.urlopen(urllib.request.Request(address, method='HEAD'), timeout=60) as response:
|
||||
if response.status != 200 or int(response.headers['Content-Length']) != item['size_bytes']:
|
||||
raise ValueError('Public ISO size mismatch')
|
||||
with urllib.request.urlopen(address + '.sha256', timeout=60) as response:
|
||||
if response.read().decode().split()[0] != item['sha256']:
|
||||
raise ValueError('Public checksum mismatch')
|
||||
for record in publication_records:
|
||||
for kind, key in (('images', 'image_commit'), ('layers', 'layer_commit')):
|
||||
with urllib.request.urlopen(url + '/ostree/' + kind + '/refs/heads/stable/' + record['variant'], timeout=60) as response:
|
||||
if response.read().decode().strip() != record[key]:
|
||||
raise ValueError('Public OSTree ref identity mismatch')
|
||||
current = []
|
||||
if mode == 'iso':
|
||||
with urllib.request.urlopen(url + '/v1/releases.json', timeout=60) as response:
|
||||
releases = json.load(response)['releases']
|
||||
current = [r for r in releases if r['current']]
|
||||
if ({r['variant'] for r in current} != set(publish_variants) or len(current) != len(publish_variants)
|
||||
or any(r['version'] != stamp for r in current)):
|
||||
raise ValueError('Published catalog does not match this cycle')
|
||||
for item in current:
|
||||
address = url.split('/archipelago')[0] + item['url']
|
||||
with urllib.request.urlopen(urllib.request.Request(address, method='HEAD'), timeout=60) as response:
|
||||
if response.status != 200 or int(response.headers['Content-Length']) != item['size_bytes']:
|
||||
raise ValueError('Public ISO size mismatch')
|
||||
with urllib.request.urlopen(address + '.sha256', timeout=60) as response:
|
||||
if response.read().decode().split()[0] != item['sha256']:
|
||||
raise ValueError('Public checksum mismatch')
|
||||
phase('cleaning-worker', releases=current)
|
||||
# Local terra worker logs must survive removal of the build workspace.
|
||||
# Preserve every nested build/CLI/guest/serial log, not just log tails.
|
||||
retain_logs()
|
||||
reused = [dict(path=builds[item['variant']], variant=item['variant'], sha256=item['sha256'])
|
||||
for item in current if not Path(builds[item['variant']]).is_relative_to(remote_root)
|
||||
and re.fullmatch(re.escape(config['worker_root'] + '/build/release-cycle/') +
|
||||
r'[0-9]{8}T[0-9]{6}Z/(core|gnome|kde)/build', builds[item['variant']])]
|
||||
if reused:
|
||||
# Preserve original build sources as well as the acceptance run sources.
|
||||
for index, item in enumerate(reused):
|
||||
original = Path(item['path']).parent.parent
|
||||
destination = run / f'reused-source-{index}.tar'
|
||||
if args.archive and (args.archive / 'source.tar').is_file():
|
||||
# Restored build-only archives need not recreate the original
|
||||
# worker source tree; preserve the selected archive's inputs.
|
||||
shutil.copyfile(args.archive / 'source.tar', destination)
|
||||
else:
|
||||
call(['rsync', '-a', f'{worker}:{original}/source.tar', str(destination)])
|
||||
remote(shlex.join(['python3', remote_root + '/source/src/infrastructure/pipeline/cleanup-worker-inputs.py',
|
||||
config['worker_root'], json.dumps(reused)]))
|
||||
remote('rm -rf ' + shlex.quote(remote_root))
|
||||
phase('complete', finished=datetime.now(timezone.utc).isoformat())
|
||||
cleanup_module.cleanup(parent, None)
|
||||
|
|
@ -470,11 +342,13 @@ rm -rf {builds['core']}/iso-work {builds['core']}/profile {builds['core']}/extra
|
|||
detail = str(error)
|
||||
concise = ('Stage command exited with code ' + str(error.returncode)) if isinstance(error, subprocess.CalledProcessError) else detail
|
||||
phase('failed', error=concise, error_details=detail, failed_phase=state['state'])
|
||||
# Stop this run's VM before archiving diagnostics; never select host VMs
|
||||
# by broad process/name patterns. Preserve artifact bytes and evidence,
|
||||
# not disposable unpacked trees that would fill the worker every day.
|
||||
containers = subprocess.check_output(['docker', 'ps', '-q', '--filter', 'label=archipelago.release-run=' + stamp], text=True).split()
|
||||
if containers:
|
||||
observer.call(['docker', 'stop', '--timeout', '20', *containers], timeout=60, check=False)
|
||||
# Never select host units by broad process/name patterns. Preserve artifact
|
||||
# bytes and evidence, not disposable unpacked trees that would fill the worker.
|
||||
observer.call(['ssh', '-o', 'BatchMode=yes', '-o', 'ConnectTimeout=15', worker,
|
||||
shlex.join(['systemctl', 'stop', vm_unit, kde_vm_unit, *worker_units])], timeout=120, check=False)
|
||||
shlex.join(['systemctl', 'stop', *worker_units])], timeout=120, check=False)
|
||||
retain_logs()
|
||||
if isinstance(error, (InterruptedError, KeyboardInterrupt)):
|
||||
# A stop means stop, not another multi-gigabyte artifact transfer.
|
||||
|
|
@ -498,10 +372,6 @@ rm -rf {builds['core']}/iso-work {builds['core']}/profile {builds['core']}/extra
|
|||
remote('rm -rf ' + shlex.quote(remote_root))
|
||||
raise
|
||||
finally:
|
||||
for unit in (vm_unit, kde_vm_unit):
|
||||
observer.call(['ssh', '-o', 'BatchMode=yes', '-o', 'ConnectTimeout=15', worker,
|
||||
'if systemctl is-active --quiet ' + shlex.quote(unit) +
|
||||
'; then systemctl stop ' + shlex.quote(unit) + '; fi'], timeout=120, check=False)
|
||||
if state.get('invocation_id'):
|
||||
observer.call(['journalctl', '_SYSTEMD_INVOCATION_ID=' + state['invocation_id'],
|
||||
'--no-pager', '--output=short-iso-precise'], timeout=60, check=False)
|
||||
|
|
|
|||
29
pipeline/release-schedule.py
Normal file
29
pipeline/release-schedule.py
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#!/usr/bin/env python3
|
||||
"""D-098: anchored three-day OSTree cadence plus calendar-day-30 ISO."""
|
||||
from datetime import date, datetime, timedelta, timezone
|
||||
import subprocess
|
||||
|
||||
ANCHOR = date(2026, 11, 9)
|
||||
|
||||
|
||||
def mode(day):
|
||||
if day.day == 30:
|
||||
return 'iso'
|
||||
if day >= ANCHOR and (day - ANCHOR).days % 3 == 0:
|
||||
return 'ostree'
|
||||
return None
|
||||
|
||||
|
||||
def next_release(now):
|
||||
day = now.astimezone(timezone.utc).date() + timedelta(days=1)
|
||||
while not mode(day):
|
||||
day += timedelta(days=1)
|
||||
return {'date': day.isoformat(), 'mode': mode(day), 'time': '00:00 UTC'}
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
today = datetime.now(timezone.utc).date()
|
||||
selected = mode(today)
|
||||
print(f'{today}: {selected or "not scheduled"}', flush=True)
|
||||
if selected:
|
||||
subprocess.run(['systemctl', 'start', '--no-block', 'archipelago-release-cycle.service'], check=True)
|
||||
|
|
@ -49,7 +49,7 @@ with tempfile.TemporaryDirectory() as tmp:
|
|||
assert m.ostree(current / 'ostree/layers', 'rev-parse', 'purpose/desktop/gnome') == records[1]['purpose_layer_commit']
|
||||
purpose_refs = [r for r in m.ostree(current / 'ostree/layers', 'refs').splitlines()
|
||||
if r.startswith('history/purpose/gnome/')]
|
||||
assert len(purpose_refs) == min(generation + 1, 3)
|
||||
assert purpose_refs == []
|
||||
assert len(list((current / 'iso').glob('*.iso'))) == 2
|
||||
api = json.loads((current / 'v1/releases.json').read_text())
|
||||
assert len(api['releases']) == 2 * min(generation + 1, 3)
|
||||
|
|
@ -63,10 +63,15 @@ with tempfile.TemporaryDirectory() as tmp:
|
|||
assert not (current / 'iso/core/0').exists()
|
||||
assert len(list((public / '.generations').iterdir())) == 1
|
||||
history = json.loads((current / 'history.json').read_text())
|
||||
assert all(len(entries) == min(generation + 1, 3) for entries in history.values())
|
||||
# D-098 keeps exactly one current image/layer entry per variant; ISO
|
||||
# history is separate so monthly media survive frequent OSTree releases.
|
||||
assert all(len(entries) == 1 for entries in history.values())
|
||||
assert all(entries[0]['version'] == str(generation) for entries in history.values())
|
||||
iso_history = json.loads((current / 'iso-history.json').read_text())
|
||||
assert all(len(entries) == min(generation + 1, 3) for entries in iso_history.values())
|
||||
for kind in ('images', 'layers'):
|
||||
target = current / 'ostree' / kind
|
||||
assert m.ostree(target, 'rev-parse', 'hardware-test/core') == records[0]['image_commit' if kind == 'images' else 'layer_commit']
|
||||
refs = m.ostree(current / 'ostree' / kind, 'refs').splitlines()
|
||||
assert not any(ref.startswith(('history/', 'iso-history/')) for ref in refs)
|
||||
before = (public / 'current').readlink()
|
||||
wrong_purpose = [dict(r) for r in records]
|
||||
wrong_purpose[1]['purpose_layer_commit'] = records[0]['layer_commit']
|
||||
|
|
@ -173,3 +178,48 @@ with tempfile.TemporaryDirectory() as tmp:
|
|||
raise AssertionError('Exception accepted for different bytes')
|
||||
assert (public / 'current').resolve() == current
|
||||
print('SCOPED_STABLE_PROMOTION_COMPATIBILITY_PASS')
|
||||
|
||||
# D-098: OSTree-only cycles advance refs without touching retained ISO
|
||||
# history, and retain no intermediate image/layer refs.
|
||||
iso_versions = {v: [e['version'] for e in rows] for v, rows in
|
||||
json.loads((current / 'iso-history.json').read_text()).items()}
|
||||
ostree_records = []
|
||||
for variant in ('core', 'gnome'):
|
||||
(payload / 'marker').write_text('ostree-only-' + variant)
|
||||
layer = m.ostree(repo, 'commit', '--orphan', '--branch=next-layer-' + variant,
|
||||
'--tree=dir=' + str(payload))
|
||||
purpose = None
|
||||
if variant == 'gnome':
|
||||
(payload / 'marker').write_text('ostree-only-purpose')
|
||||
purpose = m.ostree(repo, 'commit', '--orphan', '--branch=next-purpose', '--tree=dir=' + str(payload))
|
||||
commit = m.ostree(repo, 'commit', '--orphan', '--branch=next-' + variant,
|
||||
'--tree=dir=' + str(payload), '--add-metadata-string=archipelago.layer-core=' + layer,
|
||||
*(['--add-metadata-string=archipelago.layer-purpose=' + purpose] if purpose else []))
|
||||
rust = root / (variant + '-rust.json')
|
||||
rust.write_text(json.dumps(dict(policy='D-098', passed=True, source='src.tar',
|
||||
source_sha256='a' * 64, checks=[])) + '\n')
|
||||
r = dict(variant=variant, version='10', repo=str(repo), image_commit=commit,
|
||||
layer_commit=layer, rust_evidence=str(rust), acceptance=str(root / (variant + '-o.json')))
|
||||
if purpose:
|
||||
r['purpose_layer_commit'] = purpose
|
||||
Path(r['acceptance']).write_text(json.dumps(r | dict(scope='rust-manual', accepted=True,
|
||||
checks=[dict(path=str(rust), sha256=m.digest(rust))])))
|
||||
ostree_records.append(r)
|
||||
ostree_exception = dict(channel='stable', decision='D-098', reason='fixture OSTree-only',
|
||||
limitations=['manual'], candidates=[{k: r.get(k) for k in
|
||||
('variant', 'version', 'sha256', 'image_commit', 'layer_commit')} for r in ostree_records])
|
||||
m.publish(public, ostree_records, home, key, channel='stable', exception=ostree_exception,
|
||||
refs={'core': 'stable/core', 'gnome': 'stable/gnome'})
|
||||
current = (public / 'current').resolve()
|
||||
assert {v: [e['version'] for e in rows] for v, rows in
|
||||
json.loads((current / 'iso-history.json').read_text()).items()} == iso_versions
|
||||
assert all(entries[0]['version'] == '10' for entries in
|
||||
json.loads((current / 'history.json').read_text()).values())
|
||||
for kind, key in (('images', 'image_commit'), ('layers', 'layer_commit')):
|
||||
repo = current / 'ostree' / kind
|
||||
for r in ostree_records:
|
||||
assert m.ostree(repo, 'rev-parse', 'stable/' + r['variant']) == r[key]
|
||||
assert not any(ref.startswith(('history/', 'iso-history/')) for ref in m.ostree(repo, 'refs').splitlines())
|
||||
catalog = json.loads((current / 'v1/releases.json').read_text())
|
||||
assert sum(r['current'] for r in catalog['releases']) == 2
|
||||
print('OSTREE_ONLY_RELEASE_PASS')
|
||||
|
|
|
|||
33
tests/release-schedule.py
Normal file
33
tests/release-schedule.py
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
#!/usr/bin/env python3
|
||||
"""D-098 cadence: anchored three-day OSTree grid and calendar-day-30 ISO."""
|
||||
import importlib.util
|
||||
from datetime import date, datetime, timezone
|
||||
from pathlib import Path
|
||||
|
||||
spec = importlib.util.spec_from_file_location('schedule', Path(__file__).parents[1] / 'pipeline/release-schedule.py')
|
||||
s = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(s)
|
||||
|
||||
assert s.mode(date(2026, 11, 9)) == 'ostree'
|
||||
for day in (12, 15, 18, 21, 24, 27):
|
||||
assert s.mode(date(2026, 11, day)) == 'ostree', day
|
||||
assert s.mode(date(2026, 11, 30)) == 'iso'
|
||||
assert s.mode(date(2026, 11, 10)) is None and s.mode(date(2026, 11, 29)) is None
|
||||
# The grid is an interval, not a day-of-month rule: it continues across the
|
||||
# month and year boundary and never substitutes a missing calendar day.
|
||||
for day in (date(2026, 12, 3), date(2026, 12, 6), date(2027, 1, 2)):
|
||||
assert s.mode(day) == 'ostree', day
|
||||
assert s.mode(date(2026, 12, 30)) == 'iso'
|
||||
assert s.mode(date(2027, 2, 28)) == 'ostree'
|
||||
assert s.mode(date(2026, 11, 8)) is None
|
||||
|
||||
assert s.next_release(datetime(2026, 11, 9, 12, tzinfo=timezone.utc)) == {
|
||||
'date': '2026-11-12', 'mode': 'ostree', 'time': '00:00 UTC'}
|
||||
assert s.next_release(datetime(2026, 11, 29, 23, tzinfo=timezone.utc))['mode'] == 'iso'
|
||||
assert s.next_release(datetime(2026, 11, 30, 1, tzinfo=timezone.utc))['date'] == '2026-12-03'
|
||||
assert s.next_release(datetime(2027, 2, 27, tzinfo=timezone.utc))['date'] == '2027-02-28'
|
||||
for start in (datetime(2026, 11, 9, tzinfo=timezone.utc), datetime(2027, 3, 29, tzinfo=timezone.utc)):
|
||||
nxt = s.next_release(start)
|
||||
day = date.fromisoformat(nxt['date'])
|
||||
assert day > start.date() and s.mode(day) == nxt['mode']
|
||||
print('RELEASE_SCHEDULE_PASS')
|
||||
Loading…
Add table
Reference in a new issue