Skip to content

Commit 3c1e2c0

Browse files
Mic92mergify[bot]
authored andcommitted
cleanup drv gcroots after a build
1 parent 25e583e commit 3c1e2c0

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

buildbot_nix/__init__.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,9 @@ def nix_eval_config(
377377
haltOnFailure=True,
378378
),
379379
)
380+
drv_gcroots_dir = util.Interpolate(
381+
"/nix/var/nix/gcroots/per-user/buildbot-worker/%(prop:project)s/drvs/",
382+
)
380383

381384
factory.addStep(
382385
NixEvalCommand(
@@ -393,8 +396,7 @@ def nix_eval_config(
393396
"accept-flake-config",
394397
"true",
395398
"--gc-roots-dir",
396-
# FIXME: don't hardcode this
397-
"/var/lib/buildbot-worker/gcroot",
399+
drv_gcroots_dir,
398400
"--force-recurse",
399401
"--check-cache-status",
400402
"--flake",
@@ -405,6 +407,17 @@ def nix_eval_config(
405407
),
406408
)
407409

410+
factory.addStep(
411+
steps.ShellCommand(
412+
name="Cleanup drv paths",
413+
command=[
414+
"rm",
415+
"-rf",
416+
drv_gcroots_dir,
417+
],
418+
),
419+
)
420+
408421
return util.BuilderConfig(
409422
name=f"{project.name}/nix-eval",
410423
workernames=worker_names,

nix/master.nix

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,11 @@ in
234234
};
235235
};
236236

237-
# Allow buildbot-master to write to this directory
238-
systemd.tmpfiles.rules = lib.optional (cfg.outputsPath != null)
237+
systemd.tmpfiles.rules = [
238+
# delete legacy gcroot location, can be dropped after 2024-06-01
239+
"R /var/lib/buildbot-worker/gcroot - - - - -"
240+
] ++ lib.optional (cfg.outputsPath != null)
241+
# Allow buildbot-master to write to this directory
239242
"d ${cfg.outputsPath} 0755 buildbot buildbot - -";
240243
};
241244
}

0 commit comments

Comments
 (0)