From 3c1e2c0e761ca41a39c3fc95d11a013172e1bb86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Mon, 15 Jan 2024 13:41:48 +0100 Subject: [PATCH] cleanup drv gcroots after a build --- buildbot_nix/__init__.py | 17 +++++++++++++++-- nix/master.nix | 7 +++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/buildbot_nix/__init__.py b/buildbot_nix/__init__.py index 34ae933..3f5fd19 100644 --- a/buildbot_nix/__init__.py +++ b/buildbot_nix/__init__.py @@ -377,6 +377,9 @@ def nix_eval_config( haltOnFailure=True, ), ) + drv_gcroots_dir = util.Interpolate( + "/nix/var/nix/gcroots/per-user/buildbot-worker/%(prop:project)s/drvs/", + ) factory.addStep( NixEvalCommand( @@ -393,8 +396,7 @@ def nix_eval_config( "accept-flake-config", "true", "--gc-roots-dir", - # FIXME: don't hardcode this - "/var/lib/buildbot-worker/gcroot", + drv_gcroots_dir, "--force-recurse", "--check-cache-status", "--flake", @@ -405,6 +407,17 @@ def nix_eval_config( ), ) + factory.addStep( + steps.ShellCommand( + name="Cleanup drv paths", + command=[ + "rm", + "-rf", + drv_gcroots_dir, + ], + ), + ) + return util.BuilderConfig( name=f"{project.name}/nix-eval", workernames=worker_names, diff --git a/nix/master.nix b/nix/master.nix index 8057f06..6383d5e 100644 --- a/nix/master.nix +++ b/nix/master.nix @@ -234,8 +234,11 @@ in }; }; - # Allow buildbot-master to write to this directory - systemd.tmpfiles.rules = lib.optional (cfg.outputsPath != null) + systemd.tmpfiles.rules = [ + # delete legacy gcroot location, can be dropped after 2024-06-01 + "R /var/lib/buildbot-worker/gcroot - - - - -" + ] ++ lib.optional (cfg.outputsPath != null) + # Allow buildbot-master to write to this directory "d ${cfg.outputsPath} 0755 buildbot buildbot - -"; }; }