Handle failure with output

This commit is contained in:
Eelco Dolstra
2015-06-17 17:11:42 +02:00
parent b1a75c7f63
commit 11be780948
4 changed files with 11 additions and 9 deletions

View File

@ -27,6 +27,9 @@ BuildResult getBuildResult(std::shared_ptr<StoreAPI> store, const Derivation & d
bool explicitProducts = false;
for (auto & output : outputs) {
Path failedFile = output + "/nix-support/failed";
if (pathExists(failedFile)) res.failed = true;
Path productsFile = output + "/nix-support/hydra-build-products";
if (!pathExists(productsFile)) continue;
explicitProducts = true;

View File

@ -17,6 +17,11 @@ struct BuildProduct
struct BuildResult
{
/* Whether this build has failed with output, i.e., the build
finished with exit code 0 but produced a file
$out/nix-support/failed. */
bool failed = false;
std::string releaseName;
unsigned long long closureSize = 0, size = 0;

View File

@ -930,10 +930,6 @@ MachineReservation::ptr State::findMachine(Step::ptr step)
return std::make_shared<MachineReservation>(machine);
}
/* FIXME: distinguish between permanent failures (a matching
machine doesn't exist) and temporary failures (a matching
machine is not available). */
return 0;
}
@ -1048,8 +1044,6 @@ bool State::doBuildStep(std::shared_ptr<StoreAPI> store, Step::ptr step,
}
if (result.status == RemoteResult::rrSuccess) res = getBuildResult(store, step->drv);
// FIXME: handle failed-with-output
}
if (!result.stopTime) result.stopTime = time(0);
@ -1181,7 +1175,7 @@ void State::markSucceededBuild(pqxx::work & txn, Build::ptr build,
txn.parameterized
("update Builds set finished = 1, busy = 0, buildStatus = $2, startTime = $3, stopTime = $4, size = $5, closureSize = $6, releaseName = $7, isCachedBuild = $8 where id = $1")
(build->id)
((int) bsSuccess)
((int) (res.failed ? bsFailedWithOutput : bsSuccess))
(startTime)
(stopTime)
(res.size)