forked from lix-project/hydra
hydra-queue-runner: Write GC roots for outputs paths
We lost this behaviour somewhere. So build outputs could be GC'ed when running the collector with --option gc-keep-outputs false.
This commit is contained in:
parent
eb7631fb9d
commit
45b138373b
|
@ -263,6 +263,9 @@ State::StepResult State::doBuildStep(nix::ref<Store> destStore,
|
|||
|
||||
assert(stepNr);
|
||||
|
||||
for (auto & path : step->drv.outputPaths())
|
||||
writeFile(rootsDir + "/" + baseNameOf(path), "");
|
||||
|
||||
/* Register success in the database for all Build objects that
|
||||
have this step as the top-level step. Since the queue
|
||||
monitor thread may be creating new referring Builds
|
||||
|
|
|
@ -87,6 +87,7 @@ State::State()
|
|||
, maxOutputSize(config->getIntOption("max_output_size", 2ULL << 30))
|
||||
, maxLogSize(config->getIntOption("max_log_size", 64ULL << 20))
|
||||
, uploadLogsToBinaryCache(config->getBoolOption("upload_logs_to_binary_cache", false))
|
||||
, rootsDir(config->getStrOption("gc_roots_dir", fmt("%s/gcroots/per-user/%s/hydra-roots", settings.nixStateDir, getEnv("USER"))))
|
||||
{
|
||||
debug("using %d bytes for the NAR buffer", memoryTokens.capacity());
|
||||
|
||||
|
|
|
@ -221,6 +221,9 @@ bool State::getQueuedBuilds(Connection & conn,
|
|||
Derivation drv = readDerivation(build->drvPath);
|
||||
BuildOutput res = getBuildOutputCached(conn, destStore, drv);
|
||||
|
||||
for (auto & path : drv.outputPaths())
|
||||
writeFile(rootsDir + "/" + baseNameOf(path), "");
|
||||
|
||||
{
|
||||
auto mc = startDbUpdate();
|
||||
pqxx::work txn(conn);
|
||||
|
|
|
@ -436,6 +436,11 @@ private:
|
|||
|
||||
bool uploadLogsToBinaryCache;
|
||||
|
||||
/* Where to store GC roots. Defaults to
|
||||
/nix/var/nix/gcroots/per-user/$USER/hydra-roots, overridable
|
||||
via gc_roots_dir. */
|
||||
nix::Path rootsDir;
|
||||
|
||||
public:
|
||||
State();
|
||||
|
||||
|
|
Loading…
Reference in a new issue