Bound private artifact cleanup and document installed update channel mismatch
This commit is contained in:
parent
ace0576950
commit
5ea1e57f0b
5 changed files with 274 additions and 7 deletions
113
deploy/PIPELINE-AUDIT-2026-11-06.md
Normal file
113
deploy/PIPELINE-AUDIT-2026-11-06.md
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
# Daily pipeline operational audit — 2026-11-06
|
||||
|
||||
## Verdict
|
||||
|
||||
Ready for supervised experimental daily execution; **not yet demonstrated ready
|
||||
for unattended operation**. Publication `20261106T131152Z` succeeded, but used
|
||||
`--existing` after an explicitly authorized manual ISO-packaging recovery.
|
||||
This is hardware-test evidence, not stable/testing admission or proof of a fresh
|
||||
end-to-end autonomous build. This audit does not change the enabled timer.
|
||||
|
||||
## Evidence collected
|
||||
|
||||
- Read the coordinator, Flatpak cache/preparer, publisher and terminal hook;
|
||||
inspected deployed systemd service/timer, configuration, acceptance result,
|
||||
free space and active worker units over SSH.
|
||||
- Daily service: `Type=oneshot`, 11-hour start timeout, two-minute stop timeout,
|
||||
control-group kill and `ExecStopPost` terminal reporting. Timer is enabled,
|
||||
persistent, next scheduled run 2026-11-07 00:00 UTC.
|
||||
- Coordinator SHA256 agrees between terra and yabloko:
|
||||
`a0adbb23bf529d293d50530a275c2fb5e314288993fa6f03f8141bae8872e54d`.
|
||||
- Fixed seed-copy adapter is deployed on yabloko, SHA256
|
||||
`c695de4ba2d0525aef41200977181a71ec1ec114026b2b6ca9229c824c930ae6`.
|
||||
- Core and GNOME installed checks passed. GNOME result explicitly declares scope
|
||||
`native-gis-and-extension-baseline`. OSTree fsck and signed publication completed;
|
||||
coordinator checked public catalog identities, HTTP sizes and checksum sidecars.
|
||||
- No running `archipelago*` systemd units on yabloko at inspection.
|
||||
- Worker has about 48 GiB available, terra about 185 GiB. Reused worker build
|
||||
`20261106T114048Z` still occupies 30 GiB.
|
||||
- Re-ran three existing tests on yabloko: Flatpak verified fallback/corruption
|
||||
rejection PASS; terminal timeout ownership PASS; cycle recovery FAIL with
|
||||
`KeyError: 'worker_source_root'` at preflight. The last failure is a stale test
|
||||
fixture, not evidence that the deployed production config lacks that key.
|
||||
|
||||
## Findings
|
||||
|
||||
### High: no successful fresh autonomous cycle yet
|
||||
|
||||
The successful run bypassed both builds and Flatpak refresh using `--existing`.
|
||||
Fixes are in the normal adapters, but a complete normal run from fresh work
|
||||
directories through public verification has not exercised them together.
|
||||
|
||||
### High: storage lifecycle is incomplete
|
||||
|
||||
`pipeline/release-cycle.py:278-286` removes only the current worker run and expires
|
||||
artifact directories only for successful coordinator runs. Reused build inputs
|
||||
are outside that cleanup, explaining the remaining 30 GiB. Failed archives,
|
||||
partial transfers and source archives have no bounded aggregate storage policy.
|
||||
The free-space check at line 193 covers the worker before Core only, after
|
||||
Flatpak preparation; terra has no equivalent admission check. Repeated failures
|
||||
can consume the disk and prevent subsequent autonomous runs. Public retention
|
||||
of three versions does not bound private storage.
|
||||
|
||||
### Medium: Flatpak refresh is operationally degraded
|
||||
|
||||
Actual cache status is `cached-after-refresh-failure`, exit 124 (timeout), using
|
||||
`exports/from-iso-20261106`. Verified fallback works, but successful refresh/export
|
||||
has not been demonstrated in the current pipeline. Repeated fallback can keep
|
||||
publishing an old application set indefinitely. Expose cache age and consecutive
|
||||
failures and prove a successful refresh; do not silently remove fallback checks.
|
||||
|
||||
### Medium: failure recovery coverage is incomplete
|
||||
|
||||
`tests/cycle-recovery.py` currently fails before its intended assertions because
|
||||
its config fixture lacks `worker_source_root`. Existing test PASS claims predate
|
||||
the schema-preflight change. Fix the fixture and run interruption/recovery tests,
|
||||
including loss of the coordinator during a worker job and a publishing job.
|
||||
|
||||
### Medium: abrupt-stop cleanup is deferred
|
||||
|
||||
`pipeline/cycle-terminal.py` records terminal state but does not stop remote
|
||||
units. Normal Python exception handling does stop them; after hard termination
|
||||
they rely on individual time limits and the next run's recovery. Publisher Docker
|
||||
containers have no explicit name/cid tracking for reconciliation after loss of
|
||||
their client. This needs fault-injection verification before unattended approval;
|
||||
the audit did not terminate live infrastructure to test it.
|
||||
|
||||
### Medium: operator observability is insufficient
|
||||
|
||||
No failure notification destination is configured in the inspected service.
|
||||
`archipelago-release logs/follow` follows the regular service only, whereas the
|
||||
successful recovery ran under a different transient unit. Stage timestamps do
|
||||
not indicate progress within a long stage. Final status points to the removed
|
||||
worker run directory as a log location. Provide durable per-run logs, direct
|
||||
stage log discovery and an explicit degraded/failure signal.
|
||||
|
||||
### Medium: reused-input provenance needs a clearer link
|
||||
|
||||
With `--existing`, the coordinator archives a newly frozen source tree and newly
|
||||
compiled CLI, while the accepted ISOs were built earlier. It records input paths,
|
||||
but does not automatically carry the original run's source archive and Flatpak
|
||||
fallback status into the new top-level provenance. Recovery evidence must link
|
||||
original build inputs, packaging repair and acceptance inputs explicitly.
|
||||
|
||||
### Verification boundary
|
||||
|
||||
Public verification uses HEAD size and a SHA256 sidecar, not a full HTTPS ISO
|
||||
rehash or an independent client verification of downloaded OSTree signatures.
|
||||
Local fsck and signing are real checks; they are not equivalent to that stronger
|
||||
end-to-end transport/client test. Source freezing also archives the deployed
|
||||
worker directory; it does not fetch new source revisions automatically.
|
||||
|
||||
## Conditions for unattended approval
|
||||
|
||||
1. Bound private storage and handle retained recovery inputs with explicit safe
|
||||
cleanup; check capacity before expensive work on both hosts.
|
||||
2. Restore recovery-test coverage and verify hard interruption/restart behavior.
|
||||
3. Make logs discoverable after cleanup and expose failures and repeated fallback.
|
||||
4. Complete one fresh normal run without intervention, then a second scheduled
|
||||
run to demonstrate repeated execution, cache reuse and retention.
|
||||
5. Demonstrate a successful Flatpak refresh and retain exact input provenance.
|
||||
|
||||
Stable/testing gates (reproducibility, general Managed Overlay acceptance and
|
||||
real GUI OS-update acceptance) remain separate outstanding requirements.
|
||||
|
|
@ -1,5 +1,64 @@
|
|||
# Daily release cycle
|
||||
|
||||
## Cleanup and update-continuity review (2026-11-06)
|
||||
|
||||
Private artifact retention now runs under the cycle lock before work and after
|
||||
success: retain three completed runs and the latest failed run's bulky artifacts.
|
||||
Older terminal runs lose explicitly listed build payload/output/scratch directories,
|
||||
including copies under `failure-evidence`; source archives, logs and evidence stay.
|
||||
Unknown directories and nonterminal runs are not automatically deleted. This bounds
|
||||
bulky terminal artifacts, not the total lifetime size of diagnostic/source archives.
|
||||
Public retention remains three versions per variant.
|
||||
|
||||
Before Flatpak preparation, check worker free space; before artifact transfer,
|
||||
require `minimum_coordinator_free_bytes` (default 50,000,000,000 bytes) on terra.
|
||||
After successful publication, coordinator-owned reused build directories can be
|
||||
removed: preserve original source archives, acquire build locks, verify ISO SHA256
|
||||
against the published results, then delete only those build directories. External
|
||||
`--existing` paths are not automatically removed.
|
||||
|
||||
Manual cleanup on 2026-11-06 removed both reused worker builds from
|
||||
`20261106T114048Z` and 20 obsolete private artifact directories on terra. The
|
||||
original source archive was saved in completed run `20261106T131152Z`, which also
|
||||
contains `manual-cleanup.json`. Available space changed approximately from 48 to
|
||||
77 GiB on yabloko and 185 to 207 GiB on terra. Published objects were not removed.
|
||||
No tests or builds were run for this change, as explicitly requested; the cleanup
|
||||
helpers were executed for the authorized real cleanup.
|
||||
|
||||
### Required principle: installed ISO must update to the fresh build
|
||||
|
||||
The user explicitly requires continuity from the currently installed ISO to the
|
||||
next build, to be checked manually. **The current pipeline does not yet satisfy
|
||||
this principle out of the box.** Static code and immutable image inspection show:
|
||||
|
||||
- Both current image commits contain `/usr/lib/archipelago/update.json` selecting
|
||||
`stable/core` and `stable/gnome` (`builder/defaults/update.json`).
|
||||
- The daily publisher advances `hardware-test/core` and `hardware-test/gnome`;
|
||||
it deliberately preserves production refs (`pipeline/publish-hardware.py`).
|
||||
- Actual stable refs still identify the 20261105 images; current hardware-test
|
||||
refs identify the 20261106 images. Consequently update planning from the newest
|
||||
ISO can select the older stable image, not the next daily build.
|
||||
- `system/src/updates.rs` chooses the profile in `/etc` before the vendor profile,
|
||||
verifies summary and commit signatures, pins the target in a plan, checks the
|
||||
deployment state and Purpose, and stages it without automatic reboot. It checks
|
||||
target equality, but does not impose a monotonic version/age constraint.
|
||||
- Host Extensions are reapplied; custom Managed Overlay updates explicitly fail
|
||||
without changing the current deployment. Universal updateability for arbitrary
|
||||
custom compositions is therefore not implemented.
|
||||
- The coordinator tests fresh ISO installations; it does not require an update
|
||||
from the previously installed release. Passing this acceptance is not evidence
|
||||
of update continuity. Flatpaks in `/var` are independently updated; the ISO seed
|
||||
is not an OS-update delivery mechanism for already installed applications.
|
||||
|
||||
Resolution requires an explicit consistent channel choice: for experimental daily
|
||||
images, configure future images and the existing installation to follow hardware-test;
|
||||
alternatively qualify and publish the intended stable releases through their gates.
|
||||
Do not silently repoint stable refs to experimental commits. Changing the next ISO's
|
||||
vendor defaults alone cannot change the already installed ISO's update profile.
|
||||
The manual acceptance should record source/target commits, retained user data,
|
||||
staged deployment, explicit reboot, resulting booted commit and rollback usability.
|
||||
No update tests or host update transactions were executed in this review.
|
||||
|
||||
## Current operation: yabloko builds, terra publishes (2026-11-06)
|
||||
|
||||
The latest user instruction replaces the tall-bridge worker/downloader proposal:
|
||||
|
|
|
|||
49
pipeline/cleanup-cycle.py
Normal file
49
pipeline/cleanup-cycle.py
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
#!/usr/bin/env python3
|
||||
"""Bound private artifact retention; caller must hold the coordinator cycle lock."""
|
||||
import json
|
||||
from pathlib import Path
|
||||
import re
|
||||
import shutil
|
||||
|
||||
|
||||
def cleanup(parent, active):
|
||||
runs = []
|
||||
for path in sorted(Path(parent).iterdir()):
|
||||
if path.is_symlink() or not path.is_dir() or not re.fullmatch(r'[0-9]{8}T[0-9]{6}Z', path.name):
|
||||
continue
|
||||
state_file = path / 'state.json'
|
||||
if not state_file.is_file():
|
||||
continue
|
||||
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:])
|
||||
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'):
|
||||
build = root / variant / 'build'
|
||||
if not build.resolve().is_relative_to(path.resolve()):
|
||||
raise ValueError('Build directory escapes run: ' + str(build))
|
||||
for name in ('repo', 'output', 'iso-work', 'profile', 'tools', 'extractor',
|
||||
'core', 'core-base', 'composed', 'layer', 'purpose-stage',
|
||||
'purpose-layer', 'purpose-input', 'flatpak-seed'):
|
||||
target = build / name
|
||||
if target.is_symlink():
|
||||
target.unlink()
|
||||
removed.append(str(target))
|
||||
elif target.is_dir():
|
||||
if not target.resolve().is_relative_to(path.resolve()):
|
||||
raise ValueError('Artifact escapes run directory: ' + str(target))
|
||||
shutil.rmtree(target)
|
||||
removed.append(str(target))
|
||||
record = path / 'artifact-cleanup.json'
|
||||
record.write_text(json.dumps({'policy': 'three-complete-one-failed',
|
||||
'artifacts_expired': True}, indent=2) + '\n')
|
||||
return removed
|
||||
32
pipeline/cleanup-worker-inputs.py
Normal file
32
pipeline/cleanup-worker-inputs.py
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
#!/usr/bin/env python3
|
||||
"""Remove only coordinator-owned reused builds after matching published ISO bytes."""
|
||||
import fcntl
|
||||
import hashlib
|
||||
import json
|
||||
from pathlib import Path
|
||||
import re
|
||||
import shutil
|
||||
import sys
|
||||
|
||||
root = Path(sys.argv[1]).resolve() / 'build/release-cycle'
|
||||
inputs = json.loads(sys.argv[2])
|
||||
locks = []
|
||||
paths = []
|
||||
for item in inputs:
|
||||
path = Path(item['path'])
|
||||
if path.is_symlink() or not path.exists():
|
||||
raise ValueError('Missing or linked reused build: ' + str(path))
|
||||
relative = path.resolve().relative_to(root)
|
||||
if len(relative.parts) != 3 or not re.fullmatch(r'[0-9]{8}T[0-9]{6}Z', relative.parts[0]) or relative.parts[1:] != (item['variant'], 'build'):
|
||||
raise ValueError('Not a coordinator-owned build: ' + str(path))
|
||||
lock = (path / 'build.lock').open('a')
|
||||
fcntl.flock(lock, fcntl.LOCK_EX | fcntl.LOCK_NB)
|
||||
locks.append(lock)
|
||||
iso = path / 'output' / ('archipelago-core-latest.iso' if item['variant'] == 'core' else 'archipelago-gnome-probe.iso')
|
||||
with iso.open('rb') as stream:
|
||||
if hashlib.file_digest(stream, 'sha256').hexdigest() != item['sha256']:
|
||||
raise ValueError('Reused ISO differs from publication: ' + str(iso))
|
||||
paths.append(path)
|
||||
for path in paths:
|
||||
shutil.rmtree(path)
|
||||
print('Removed published reused build: ' + str(path), flush=True)
|
||||
|
|
@ -17,6 +17,11 @@ import shutil
|
|||
import signal
|
||||
import subprocess
|
||||
import urllib.request
|
||||
import importlib.util
|
||||
|
||||
cleanup_spec = importlib.util.spec_from_file_location('cleanup_cycle', Path(__file__).with_name('cleanup-cycle.py'))
|
||||
cleanup_module = importlib.util.module_from_spec(cleanup_spec)
|
||||
cleanup_spec.loader.exec_module(cleanup_module)
|
||||
|
||||
|
||||
def atomic(path, value):
|
||||
|
|
@ -154,6 +159,7 @@ python3 {remote_root}/probes/core_iso_acceptance.py --iso {shlex.quote(builds['c
|
|||
old['worker_recovery_run'] = stamp
|
||||
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')
|
||||
# Compile from the frozen source tree, not a possibly stale deployed CLI.
|
||||
phase('freezing-and-compiling-source')
|
||||
|
|
@ -168,6 +174,7 @@ sha256sum {remote_root}/archipelago > {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''')
|
||||
if config.get('flatpak_cache') and not args.existing:
|
||||
remote(f'test "$(df -PB1 {remote_root} | awk \'NR==2 {{print $4}}\')" -ge {config.get("minimum_build_free_bytes", 45000000000)}')
|
||||
phase('updating-flatpak-cache')
|
||||
refresh = int(config.get('flatpak_refresh_seconds', 1800))
|
||||
remote(shlex.join(['bash', remote_root + '/source/src/infrastructure/pipeline/flatpak-cache.sh',
|
||||
|
|
@ -198,6 +205,8 @@ rm -rf {builds['core']}/iso-work {builds['core']}/profile {builds['core']}/extra
|
|||
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', 10800)
|
||||
validate_pair()
|
||||
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')
|
||||
for variant in ('core', 'gnome'):
|
||||
dest = run / variant / 'build'
|
||||
dest.mkdir(parents=True)
|
||||
|
|
@ -275,15 +284,20 @@ rm -rf {builds['core']}/iso-work {builds['core']}/profile {builds['core']}/extra
|
|||
if response.read().decode().split()[0] != item['sha256']:
|
||||
raise ValueError('Public checksum mismatch')
|
||||
phase('cleaning-worker', releases=current)
|
||||
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)/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
|
||||
call(['rsync', '-a', f'{worker}:{original}/source.tar', str(run / f'reused-source-{index}.tar')])
|
||||
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())
|
||||
completed = sorted(p for p in parent.iterdir() if p.is_dir() and (p / 'state.json').exists()
|
||||
and json.loads((p / 'state.json').read_text()).get('state') == 'complete')
|
||||
for old in completed[:-3]:
|
||||
for variant in ('core', 'gnome'):
|
||||
# Keep evidence/source/status, expire only archived artifact bytes.
|
||||
for name in ('repo', 'output'):
|
||||
shutil.rmtree(old / variant / 'build' / name, ignore_errors=True)
|
||||
cleanup_module.cleanup(parent, None)
|
||||
except BaseException as error:
|
||||
detail = str(error)
|
||||
concise = ('Команда этапа завершилась с кодом ' + str(error.returncode)) if isinstance(error, subprocess.CalledProcessError) else detail
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue