Add a error type for "unsupported system type"

This commit is contained in:
Eelco Dolstra 2015-06-15 15:07:04 +02:00
parent 541fbd62cc
commit 5019fceb20
4 changed files with 25 additions and 15 deletions

View file

@ -33,6 +33,7 @@ typedef enum {
bsDepFailed = 2, bsDepFailed = 2,
bsAborted = 3, bsAborted = 3,
bsFailedWithOutput = 6, bsFailedWithOutput = 6,
bsUnsupported = 9,
} BuildStatus; } BuildStatus;
@ -40,6 +41,7 @@ typedef enum {
bssSuccess = 0, bssSuccess = 0,
bssFailed = 1, bssFailed = 1,
bssAborted = 4, bssAborted = 4,
bssUnsupported = 9,
bssBusy = 100, // not stored bssBusy = 100, // not stored
} BuildStepStatus; } BuildStepStatus;
@ -343,7 +345,7 @@ int State::createBuildStep(pqxx::work & txn, time_t startTime, Build::ptr build,
(propagatedFrom, propagatedFrom != 0) (propagatedFrom, propagatedFrom != 0)
(errorMsg, errorMsg != "") (errorMsg, errorMsg != "")
(startTime, status != bssBusy) (startTime, status != bssBusy)
(machine, machine != "").exec(); (machine).exec();
for (auto & output : step->drv.outputs) for (auto & output : step->drv.outputs)
txn.parameterized txn.parameterized
@ -500,21 +502,23 @@ void State::getQueuedBuilds(Connection & conn, std::shared_ptr<StoreAPI> store,
for (auto & m : *machines_) for (auto & m : *machines_)
if (m->supportsStep(r)) { supported = true; break; } if (m->supportsStep(r)) { supported = true; break; }
} }
if (!supported) { allSupported = false; break; } if (!supported) {
allSupported = false;
printMsg(lvlError, format("aborting unsupported build %1%") % build->id);
pqxx::work txn(conn);
time_t now = time(0);
txn.parameterized
("update Builds set finished = 1, busy = 0, buildStatus = $2, startTime = $3, stopTime = $3 where id = $1")
(build->id)
((int) bsUnsupported)
(now).exec();
createBuildStep(txn, now, build, r, "", bssUnsupported);
txn.commit();
break;
}
} }
if (!allSupported) { if (!allSupported) continue;
printMsg(lvlError, format("aborting unsupported build %1%") % build->id);
pqxx::work txn(conn);
txn.parameterized
("update Builds set finished = 1, busy = 0, buildStatus = $2, startTime = $3, stopTime = $3, errorMsg = $4 where id = $1")
(build->id)
((int) bsAborted)
(time(0))
("unsupported system type").exec();
txn.commit();
continue;
}
/* Note: if we exit this scope prior to this, the build and /* Note: if we exit this scope prior to this, the build and
all newly created steps are destroyed. */ all newly created steps are destroyed. */

View file

@ -56,6 +56,8 @@
<span class="error">Timed out</span> <span class="error">Timed out</span>
[% ELSIF step.status == 8 %] [% ELSIF step.status == 8 %]
<span class="error">Cached failure</span> <span class="error">Cached failure</span>
[% ELSIF step.status == 9 %]
<span class="error">Unsupported system type</span>
[% ELSIF step.errormsg %] [% ELSIF step.errormsg %]
<span class="error">Failed: [% HTML.escape(step.errormsg) %]</span> <span class="error">Failed: [% HTML.escape(step.errormsg) %]</span>
[% ELSE %] [% ELSE %]

View file

@ -198,7 +198,7 @@ BLOCK renderBuildStatusIcon;
<img src="[% c.uri_for("/static/images/error_${size}.png") %]" alt="Failed" class="build-status" /> <img src="[% c.uri_for("/static/images/error_${size}.png") %]" alt="Failed" class="build-status" />
[% ELSIF buildstatus == 2 || buildstatus == 5 %] [% ELSIF buildstatus == 2 || buildstatus == 5 %]
<img src="[% c.uri_for("/static/images/dependency_${size}.png") %]" alt="Dependency failed" class="build-status" /> <img src="[% c.uri_for("/static/images/dependency_${size}.png") %]" alt="Dependency failed" class="build-status" />
[% ELSIF buildstatus == 3 %] [% ELSIF buildstatus == 3 || buildstatus == 9 %]
<img src="[% c.uri_for("/static/images/warning_${size}.png") %]" alt="Aborted" class="build-status" /> <img src="[% c.uri_for("/static/images/warning_${size}.png") %]" alt="Aborted" class="build-status" />
[% 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" />
@ -229,6 +229,8 @@ BLOCK renderStatus;
<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 result)</span>
[% ELSIF buildstatus == 9 %]
<span class="error">Unsupported system type</span>
[% ELSE %] [% ELSE %]
<span class="error">Aborted</span> <span class="error">Aborted</span>
(Hydra failure; see <a href="#nix-error">below</a>) (Hydra failure; see <a href="#nix-error">below</a>)

View file

@ -180,6 +180,7 @@ create table Builds (
-- 4 = build cancelled (removed from queue; never built) -- 4 = build cancelled (removed from queue; never built)
-- 5 = build not done because a dependency failed previously (obsolete) -- 5 = build not done because a dependency failed previously (obsolete)
-- 6 = failure with output -- 6 = failure with output
-- 9 = unsupported system type
buildStatus integer, buildStatus integer,
errorMsg text, -- error message in case of a Nix failure errorMsg text, -- error message in case of a Nix failure
@ -227,6 +228,7 @@ create table BuildSteps (
-- 4 = aborted -- 4 = aborted
-- 7 = timed out -- 7 = timed out
-- 8 = cached failure -- 8 = cached failure
-- 9 = unsupported system type
status integer, status integer,
errorMsg text, errorMsg text,