Upload build logs to the binary cache

This commit is contained in:
Eelco Dolstra
2017-03-15 16:43:54 +01:00
parent 7e6486e694
commit 150228d7de
3 changed files with 17 additions and 1 deletions

View File

@ -3,6 +3,7 @@
#include "state.hh"
#include "build-result.hh"
#include "finally.hh"
#include "binary-cache-store.hh"
using namespace nix;
@ -148,6 +149,18 @@ State::StepResult State::doBuildStep(nix::ref<Store> destStore,
}
if (stepNr) {
/* Upload the log file to the binary cache. FIXME: should
be done on a worker thread. */
try {
auto store = destStore.dynamic_pointer_cast<BinaryCacheStore>();
if (uploadLogsToBinaryCache && store && pathExists(result.logFile)) {
store->upsertFile("log/" + baseNameOf(buildDrvPath), readFile(result.logFile), "text/plain");
unlink(result.logFile.c_str());
}
} catch (...) {
ignoreException();
}
/* Asynchronously run plugins. FIXME: if we're killed,
plugin actions might not be run. Need to ensure
at-least-once semantics. */