From 11be780948e6b89ae8619e7c85b43176f1c42a1d Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 17 Jun 2015 17:11:42 +0200 Subject: [PATCH] Handle failure with output --- src/hydra-queue-runner/build-result.cc | 3 +++ src/hydra-queue-runner/build-result.hh | 5 +++++ src/hydra-queue-runner/hydra-queue-runner.cc | 8 +------- src/root/common.tt | 4 ++-- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/hydra-queue-runner/build-result.cc b/src/hydra-queue-runner/build-result.cc index e7a2fda3..78b9b25c 100644 --- a/src/hydra-queue-runner/build-result.cc +++ b/src/hydra-queue-runner/build-result.cc @@ -27,6 +27,9 @@ BuildResult getBuildResult(std::shared_ptr 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; diff --git a/src/hydra-queue-runner/build-result.hh b/src/hydra-queue-runner/build-result.hh index bbe6fd7a..c8965345 100644 --- a/src/hydra-queue-runner/build-result.hh +++ b/src/hydra-queue-runner/build-result.hh @@ -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; diff --git a/src/hydra-queue-runner/hydra-queue-runner.cc b/src/hydra-queue-runner/hydra-queue-runner.cc index 492b44a0..c5f657f4 100644 --- a/src/hydra-queue-runner/hydra-queue-runner.cc +++ b/src/hydra-queue-runner/hydra-queue-runner.cc @@ -930,10 +930,6 @@ MachineReservation::ptr State::findMachine(Step::ptr step) return std::make_shared(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 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) diff --git a/src/root/common.tt b/src/root/common.tt index f02ed838..44f962bd 100644 --- a/src/root/common.tt +++ b/src/root/common.tt @@ -203,7 +203,7 @@ BLOCK renderBuildStatusIcon; [% ELSIF buildstatus == 4 %] Cancelled [% ELSIF buildstatus == 6 %] - Failed (with result) + Failed with output [% ELSIF buildstatus == 7 %] Timed out [% ELSE %] @@ -230,7 +230,7 @@ BLOCK renderStatus; [% ELSIF buildstatus == 4 %] Cancelled by user [% ELSIF buildstatus == 6 %] - Build failed (with result) + Build failed with output [% ELSIF buildstatus == 7 %] Timed out [% ELSIF buildstatus == 9 %]