From cac04a456b740d204cf28093ba6a9150634816fd Mon Sep 17 00:00:00 2001 From: CroneKorkN Date: Sun, 10 May 2026 18:55:24 +0200 Subject: [PATCH] left4me: make pip_install self-healing on every apply MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous shape (`triggered: True`, in git_deploy's triggers list) meant pip_install only ran when something upstream fired. After a partial first-apply failure (where git_deploy succeeded but pip_install failed for an unrelated reason), subsequent applies couldn't recover — git_deploy was already in desired state, nothing fired pip_install. Drop `triggered: True`. Drop pip_install from git_deploy's triggers (bw enforces a triggers→triggered:True invariant). Add `unless`: sudo -u left4me /opt/left4me/.venv/bin/python -c "import l4d2host, l4d2web" to short-circuit when the venv is already correct. Editable installs pick up code changes automatically — no need to re-pip on every git update. For dep changes (rare), nudge manually: bw run ovh.left4me 'sudo -u left4me /opt/left4me/.venv/bin/pip install -e /opt/left4me/src/l4d2host -e /opt/left4me/src/l4d2web' --- bundles/left4me/items.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/bundles/left4me/items.py b/bundles/left4me/items.py index b45c169..44faf52 100644 --- a/bundles/left4me/items.py +++ b/bundles/left4me/items.py @@ -134,12 +134,12 @@ git_deploy = { # sudo) — files end up root-owned. Chown so subsequent # `pip install -e` running as left4me can write .egg-info/. 'action:left4me_chown_src', - # create_venv is gated by `unless` for idempotency and doesn't - # need to refire on git updates — once the venv exists, it - # persists. pip_install IS retriggered so editable installs - # pick up the new code. - 'action:left4me_pip_install', ], + # pip_install is NOT in triggers (it's not triggered:True so bw + # would reject the edge). It runs on every apply with an `unless` + # guard for idempotency; editable installs pick up code changes + # without re-running pip. For dep changes (rare), nudge by hand: + # `bw run ovh.left4me ''`. }, } @@ -181,9 +181,11 @@ actions['left4me_pip_upgrade'] = { } actions['left4me_pip_install'] = { - # Single pip invocation installs both editable packages from the same checkout. + # Single pip invocation installs both editable packages from the same + # checkout. Runs on every apply and self-heals after partial failures; + # `unless` short-circuits when both packages are already importable. 'command': 'sudo -u left4me /opt/left4me/.venv/bin/pip install -e /opt/left4me/src/l4d2host -e /opt/left4me/src/l4d2web', - 'triggered': True, + 'unless': 'sudo -u left4me /opt/left4me/.venv/bin/python -c "import l4d2host, l4d2web"', 'cascade_skip': False, 'needs': [ 'git_deploy:/opt/left4me/src',