From 16c853545a9f547be2c19bf566f9342fcb174300 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Tue, 29 Sep 2026 17:24:05 +0200 Subject: [PATCH] fix(deploy): stop the dedicated deploy from git-cleaning its own checkout `MODE_CLEANUP` says what to tidy on the deployed system: prune unused Docker resources, clear Mastodon caches, switch an LDAP user list from `present` to `exact`. Eight roles read it that way. The dedicated runner read the same flag and ran `make clean` in the control repository instead, which is `git clean -fdX` over every ignored path there. `inventories/production/` is one of those paths. The published host install guide provisions into it and then deploys against `$INVENTORY/.password`, so the deploy deleted the vault password it was about to use: Removing inventories/production/ [ERROR] The vault password file .../inventories/production/.password was not found Reproduced in CI on two unrelated rows, arm64/zfs/debian and amd64/btrfs/centos, so it is neither architecture nor filesystem specific. The coupling was a name collision, not a decision. 7e5990aa16 generated the MODE_* flags from `01_modes.yml` and removed the legacy skip flags, and the repository clean - which had had a flag of its own - was attached to the generated `MODE_CLEANUP` because one now existed by that name. No other deploy path does this; `container`, `development` and `swarm` never call `make` at all. `make clean` keeps its own entry points, `make setup-clean`, `make clean-sudo` and `infinito --git-clean`, where a caller asks for it deliberately. Co-Authored-By: Claude Opus 5 (1M context) --- cli/administration/deploy/dedicated/runner.py | 6 ------ .../cli/administration/deploy/dedicated/test_runner.py | 6 +++++- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/cli/administration/deploy/dedicated/runner.py b/cli/administration/deploy/dedicated/runner.py index fe858f4854..69df23f4b5 100644 --- a/cli/administration/deploy/dedicated/runner.py +++ b/cli/administration/deploy/dedicated/runner.py @@ -37,12 +37,6 @@ def run_ansible_playbook( start_time = datetime.datetime.now(tz=datetime.UTC) print(f"\n▶️ Script started at: {start_time.isoformat()}\n", flush=True) - if modes.get("MODE_CLEANUP", False): - print("\n🧹 Cleaning up...\n", flush=True) - run_make(repo_root, "clean") - else: - print("\n🧹 Cleanup skipped (MODE_CLEANUP not set or False)\n", flush=True) - if not skip_build: print("\n🛠️ Running project build (make setup)...\n", flush=True) run_make(repo_root, "setup") diff --git a/tests/unit/python/cli/administration/deploy/dedicated/test_runner.py b/tests/unit/python/cli/administration/deploy/dedicated/test_runner.py index 11c8f45ab3..695b6dcd8f 100644 --- a/tests/unit/python/cli/administration/deploy/dedicated/test_runner.py +++ b/tests/unit/python/cli/administration/deploy/dedicated/test_runner.py @@ -89,7 +89,11 @@ class TestRunAnsiblePlaybook(unittest.TestCase): def was_called(cmd: list[str]) -> bool: return any(call_cmd == cmd for call_cmd, _kw in calls) - self.assertTrue(was_called(["make", "clean"]), "Expected 'make clean'") + self.assertFalse( + was_called(["make", "clean"]), + "MODE_CLEANUP tidies the deployed system, so it must not git-clean " + "the control checkout and delete the inventory being deployed", + ) self.assertTrue(was_called(["make", "setup"]), "Expected 'make setup'") for call_cmd, kw in calls: