1
0
Fork 0
mirror of https://github.com/NixOS/hydra.git synced 2024-10-18 17:02:28 -04:00

hydra-eval-jobs: Transmit original Nix error when handling aggregate jobs

It might happen that a job from the aggregate returned an error!

This is what the vague "[json.exception.type_error.302] type must be string, but is null"
was all about in this instance; there was no `drvPath` to stringify!

So we now actively watch for errors and copy them to the aggregate job.
This commit is contained in:
Samuel Dionne-Riel 2020-10-25 19:15:16 -04:00
parent 68e689cace
commit b5140c1da1

View file

@ -467,11 +467,19 @@ int main(int argc, char * * argv)
auto job2 = state->jobs.find(jobName2); auto job2 = state->jobs.find(jobName2);
if (job2 == state->jobs.end()) if (job2 == state->jobs.end())
throw Error("aggregate job '%s' references non-existent job '%s'", jobName, jobName2); throw Error("aggregate job '%s' references non-existent job '%s'", jobName, jobName2);
if ((*job2).find("error") != (*job2).end()) {
if (job.find("error") == job.end()) {
job["error"] = fmt("Errors aggregating aggregate job '%1%'.\n", jobName);
}
job["error"] = fmt("While handling '%1%': %2%\n", jobName2, (std::string) (*job2)["error"]);
} else {
auto drvPath2 = store->parseStorePath((std::string) (*job2)["drvPath"]); auto drvPath2 = store->parseStorePath((std::string) (*job2)["drvPath"]);
auto drv2 = store->readDerivation(drvPath2); auto drv2 = store->readDerivation(drvPath2);
job["constituents"].push_back(store->printStorePath(drvPath2)); job["constituents"].push_back(store->printStorePath(drvPath2));
drv.inputDrvs[drvPath2] = {drv2.outputs.begin()->first}; drv.inputDrvs[drvPath2] = {drv2.outputs.begin()->first};
} }
}
std::string drvName(drvPath.name()); std::string drvName(drvPath.name());
assert(hasSuffix(drvName, drvExtension)); assert(hasSuffix(drvName, drvExtension));