cleanup drv gcroots after a build

This commit is contained in:
Jörg Thalheim 2024-01-15 13:41:48 +01:00 committed by mergify[bot]
parent 25e583ea9e
commit 3c1e2c0e76
2 changed files with 20 additions and 4 deletions

View file

@ -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,

View file

@ -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 - -";
};
}