Support testing build determinism
Builds can now specify the attribute "isDeterministic = true" to tell Hydra to build with build-repeat > 0. If there is a mismatch between rounds, the step / build fails with a suitable status. Maybe this should be a meta attribute, but that makes it invisible to hydra-queue-runner, and it seems reasonable to make a claim of mandatory determinism part of the derivation (since e.g. enabling this flag should trigger a rebuild).
This commit is contained in:
@ -169,7 +169,7 @@ void State::buildRemote(ref<Store> destStore,
|
||||
unsigned int remoteVersion;
|
||||
|
||||
try {
|
||||
to << SERVE_MAGIC_1 << 0x202;
|
||||
to << SERVE_MAGIC_1 << 0x203;
|
||||
to.flush();
|
||||
|
||||
unsigned int magic = readInt(from);
|
||||
@ -180,6 +180,8 @@ void State::buildRemote(ref<Store> destStore,
|
||||
throw Error(format("unsupported ‘nix-store --serve’ protocol version on ‘%1%’") % machine->sshName);
|
||||
if (GET_PROTOCOL_MINOR(remoteVersion) >= 1)
|
||||
sendDerivation = false;
|
||||
if (GET_PROTOCOL_MINOR(remoteVersion) < 3 && step->isDeterministic)
|
||||
throw Error("machine ‘%1%’ does not support deterministic builds; please upgrade it to Nix 1.12", machine->sshName);
|
||||
|
||||
} catch (EndOfFile & e) {
|
||||
child.pid.wait(true);
|
||||
@ -261,6 +263,9 @@ void State::buildRemote(ref<Store> destStore,
|
||||
to << maxSilentTime << buildTimeout;
|
||||
if (GET_PROTOCOL_MINOR(remoteVersion) >= 2)
|
||||
to << 64 * 1024 * 1024; // == maxLogSize
|
||||
if (GET_PROTOCOL_MINOR(remoteVersion) >= 3)
|
||||
// FIXME: make the number of repeats configurable.
|
||||
to << (step->isDeterministic ? 1 : 0);
|
||||
to.flush();
|
||||
|
||||
result.startTime = time(0);
|
||||
@ -325,6 +330,11 @@ void State::buildRemote(ref<Store> destStore,
|
||||
case BuildResult::LogLimitExceeded:
|
||||
result.stepStatus = bsLogLimitExceeded;
|
||||
break;
|
||||
case BuildResult::NotDeterministic:
|
||||
result.stepStatus = bsNotDeterministic;
|
||||
result.canRetry = false;
|
||||
result.canCache = true;
|
||||
break;
|
||||
default:
|
||||
result.stepStatus = bsAborted;
|
||||
break;
|
||||
|
Reference in New Issue
Block a user