Skip to content

Commit

Permalink
cleanup drv gcroots after a build
Browse files Browse the repository at this point in the history
  • Loading branch information
Mic92 authored and mergify[bot] committed Jan 15, 2024
1 parent 25e583e commit 3c1e2c0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
17 changes: 15 additions & 2 deletions buildbot_nix/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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",
Expand All @@ -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,
Expand Down
7 changes: 5 additions & 2 deletions nix/master.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 - -";
};
}

0 comments on commit 3c1e2c0

Please sign in to comment.