Release driver: Type=exec so a stop is delivered immediately

systemd does not send SIGTERM to an activating oneshot; stop waited out
TimeoutStopSec=2min and then SIGKILLed the coordinator while it kept building, so a
manual stop looked ignored. The driver is a long-running job, and each worker action
is already bounded by the driver. Guarded by a control_portal test.
This commit is contained in:
Pavel Isaev 2026-11-15 22:51:40 +03:00
parent c1d6fa4b9d
commit 4a3a9fbe59
3 changed files with 27 additions and 3 deletions

View file

@ -2,6 +2,21 @@
Updated 2026-11-15. Architectural acceptance is separate from implementation.
## A stop takes effect immediately, not after two minutes (2026-11-15)
`archipelago-release-cycle.service` was `Type=oneshot`. systemd does not deliver
SIGTERM to an activating oneshot; `systemctl stop` therefore sat in `stop-sigterm`
until `TimeoutStopSec=2min` expired and then SIGKILLed the coordinator. The portal
uses `--no-block`, so it answered 202 immediately while the run kept building, and
a manual stop looked ignored. Reproduced with a minimal `Type=oneshot` unit (SIGTERM
to the main process works, `systemctl stop` does not) and fixed by declaring the
driver what it is — a long-running job: `Type=exec`. A probe unit with the same
shape now stops in 25 ms and the coordinator writes its own `signal 15` failure and
worker-unit cleanup. `infrastructure/tests/control_portal.py` guards against
reverting to oneshot. Stopped run `20261115T194326Z` (started with the existing
`2026-11-12` snapshot by mistake) left state `failed`, 32 MiB of disposable worker
work and no stray mounts or transient units.
## Manual builds pinned to an immutable snapshot, desktop Zen kernel (2026-11-15)
The portal can now start a build itself and pin the repository it compiles from.

View file

@ -4,12 +4,14 @@ Wants=network-online.target
After=network-online.target docker.service
[Service]
Type=oneshot
# Type=exec, not oneshot: systemd does not deliver SIGTERM to an activating
# oneshot, so `systemctl stop` only took effect after TimeoutStopSec and the
# portal showed a run as unstoppable for two minutes. The driver is a long-running
# job; each of its worker actions is bounded to four hours by the driver itself.
Type=exec
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.
TimeoutStartSec=infinity
TimeoutStopSec=2min
KillMode=control-group
StandardOutput=journal

View file

@ -120,6 +120,13 @@ class Portal(unittest.TestCase):
with self.assertRaises(ValueError):
app.snapshot_date('latest')
def test_release_unit_can_be_stopped_promptly(self):
# A long-running driver must not be a oneshot: systemd then refuses to
# deliver SIGTERM until TimeoutStopSec, so a stop looks ignored for minutes.
unit = (Path(__file__).parents[1] / 'deploy/archipelago-release-cycle.service').read_text()
self.assertIn('Type=exec', unit)
self.assertNotIn('Type=oneshot', unit)
def test_progress_markup_and_percentage_rules(self):
root = Path(__file__).parents[1] / 'control'
html = (root / 'index.html').read_text()