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; bool explicitProducts = false;
for (auto & output : outputs) { for (auto & output : outputs) {
Path failedFile = output + "/nix-support/failed";
if (pathExists(failedFile)) res.failed = true;
Path productsFile = output + "/nix-support/hydra-build-products"; Path productsFile = output + "/nix-support/hydra-build-products";
if (!pathExists(productsFile)) continue; if (!pathExists(productsFile)) continue;
explicitProducts = true; explicitProducts = true;

View file

@ -17,6 +17,11 @@ struct BuildProduct
struct BuildResult 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; std::string releaseName;
unsigned long long closureSize = 0, size = 0; 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); 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; 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); if (result.status == RemoteResult::rrSuccess) res = getBuildResult(store, step->drv);
// FIXME: handle failed-with-output
} }
if (!result.stopTime) result.stopTime = time(0); if (!result.stopTime) result.stopTime = time(0);
@ -1181,7 +1175,7 @@ void State::markSucceededBuild(pqxx::work & txn, Build::ptr build,
txn.parameterized 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") ("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) (build->id)
((int) bsSuccess) ((int) (res.failed ? bsFailedWithOutput : bsSuccess))
(startTime) (startTime)
(stopTime) (stopTime)
(res.size) (res.size)

View file

@ -203,7 +203,7 @@ BLOCK renderBuildStatusIcon;
[% ELSIF buildstatus == 4 %] [% ELSIF buildstatus == 4 %]
<img src="[% c.uri_for("/static/images/forbidden_${size}.png") %]" alt="Cancelled" class="build-status" /> <img src="[% c.uri_for("/static/images/forbidden_${size}.png") %]" alt="Cancelled" class="build-status" />
[% ELSIF buildstatus == 6 %] [% ELSIF buildstatus == 6 %]
<img src="[% c.uri_for("/static/images/error_${size}.png") %]" alt="Failed (with result)" class="build-status" /> <img src="[% c.uri_for("/static/images/error_${size}.png") %]" alt="Failed with output" class="build-status" />
[% ELSIF buildstatus == 7 %] [% ELSIF buildstatus == 7 %]
<img src="[% c.uri_for("/static/images/warning_${size}.png") %]" alt="Timed out" class="build-status" /> <img src="[% c.uri_for("/static/images/warning_${size}.png") %]" alt="Timed out" class="build-status" />
[% ELSE %] [% ELSE %]
@ -230,7 +230,7 @@ BLOCK renderStatus;
[% ELSIF buildstatus == 4 %] [% ELSIF buildstatus == 4 %]
<span class="error">Cancelled by user</span> <span class="error">Cancelled by user</span>
[% ELSIF buildstatus == 6 %] [% ELSIF buildstatus == 6 %]
<span class="error">Build failed (with result)</span> <span class="error">Build failed with output</span>
[% ELSIF buildstatus == 7 %] [% ELSIF buildstatus == 7 %]
<span class="error">Timed out</span> <span class="error">Timed out</span>
[% ELSIF buildstatus == 9 %] [% ELSIF buildstatus == 9 %]