The queue runner used to special-case localhost
as a remote builder:
Rather than using the normal remote-build (using the
cmdBuildDerivation
command), it was using the (generally less
efficient, except when running against localhost) cmdBuildPaths
command because the latter didn't require a privileged Nix user (so made
testing easier − allowing to run hydra in a container in particular).
However:
TJWMCLXXJY7ZZTNCM2B5KAINSQN46NECSXFFF4Y7XIVZKB3TO7SAC
J5YPMWCJCTBMNR67TSQSJKJPACOBFQJ5NHFUCP3QHT6FMPH4TXMAC
FNWNZYKURCR4YEGMPQADOD3FE4CA4ZRU34KVLP5GA75PI7GOX23QC
BYVRA54QBKHLFOPIRBJKZZI7JYBYHSOK7MIA3TUZTALZQJGG3G7QC
5AIYUMTBY6TFQTBRP3MJ2PYWUMRF57I77NIVWYE74UMEVQMBWZVQC
YSZQ3ORRQ6ELPGEQMXO4IEVD5BT2JRXUPJ44K52DLDFTAJLHKQVAC
2GRQJZT6YNH32ZAXX3OALH7Z3XU3YTPH4SBTMG5ZZ373KHYFXZ7AC
NAYQT2GTCJPBFRSK7CBFX655F2NGTBPICJSCYG2CSCQ5NRDHZG6QC
WV4SSAIYM4SVBQ2VISDTAXQJCPKRGTLSVFH44CQFEMC4COWG5OKQC
EBJP3MNAC4CRYGMJJHMKUYWTXP3N4WMMORRLDSDHQVF5ZLOTIENQC
G7KWXSFMFPFSCJ7ZD4Z6RNZSDHMHTOUDO3G6R6GYO6VDUDPMIKDQC
YVFKZFAP7JQWQ5ROYNEDXTLGWNZ2ZJ6I5OAYLWBMQBWOQE5XQAVQC
BG6PEOB2M2Y56QPVMELU7VNNCGNMSQ2K6ATBUCPJLKPLTDWNJQ5AC
EPWEMRI23UN6C777AL2GWEOXYZRTPEPFC2SZVZ4JTWUGYVFDL5XAC
EFWDY2V7ILJBFQ6NADBESYZTPHQBXKNO5N4DPNABL7X4XMNNTNYAC
// Always send the derivation to localhost, since it's a
// no-op anyway but we might not be privileged to use
// cmdBuildDerivation (e.g. if we're running in a NixOS
// container).
if (GET_PROTOCOL_MINOR(remoteVersion) >= 1 && !machine->isLocalhost())
sendDerivation = false;
if (sendDerivation)
inputs.insert(step->drvPath);
else
for (auto & p : step->drv->inputSrcs)
inputs.insert(p);
for (auto & p : step->drv->inputSrcs)
inputs.insert(p);
if (sendDerivation) {
to << cmdBuildPaths;
worker_proto::write(*localStore, to, StorePathSet{step->drvPath});
} else {
to << cmdBuildDerivation << localStore->printStorePath(step->drvPath);
writeDerivation(to, *localStore, basicDrv);
}
to << cmdBuildDerivation << localStore->printStorePath(step->drvPath);
writeDerivation(to, *localStore, basicDrv);
if (sendDerivation) {
if (res) {
result.errorMsg = fmt("%s on ‘%s’", readString(from), machine->sshName);
if (res == 100) {
result.stepStatus = bsFailed;
result.canCache = true;
}
else if (res == 101) {
result.stepStatus = bsTimedOut;
}
else {
result.stepStatus = bsAborted;
result.canRetry = true;
}
return;
}
result.stepStatus = bsSuccess;
} else {
result.errorMsg = readString(from);
if (GET_PROTOCOL_MINOR(remoteVersion) >= 3) {
result.timesBuilt = readInt(from);
result.isNonDeterministic = readInt(from);
auto start = readInt(from);
auto stop = readInt(from);
if (start && start) {
/* Note: this represents the duration of a single
round, rather than all rounds. */
result.startTime = start;
result.stopTime = stop;
}
}
switch ((BuildResult::Status) res) {
case BuildResult::Built:
result.stepStatus = bsSuccess;
break;
case BuildResult::Substituted:
case BuildResult::AlreadyValid:
result.stepStatus = bsSuccess;
result.isCached = true;
break;
case BuildResult::PermanentFailure:
result.stepStatus = bsFailed;
result.canCache = true;
result.errorMsg = "";
break;
case BuildResult::InputRejected:
case BuildResult::OutputRejected:
result.stepStatus = bsFailed;
result.canCache = true;
break;
case BuildResult::TransientFailure:
result.stepStatus = bsFailed;
result.canRetry = true;
result.errorMsg = "";
break;
case BuildResult::TimedOut:
result.stepStatus = bsTimedOut;
result.errorMsg = "";
break;
case BuildResult::MiscFailure:
result.stepStatus = bsAborted;
result.canRetry = true;
break;
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;
result.errorMsg = readString(from);
if (GET_PROTOCOL_MINOR(remoteVersion) >= 3) {
result.timesBuilt = readInt(from);
result.isNonDeterministic = readInt(from);
auto start = readInt(from);
auto stop = readInt(from);
if (start && start) {
/* Note: this represents the duration of a single
round, rather than all rounds. */
result.startTime = start;
result.stopTime = stop;
if (result.stepStatus != bsSuccess) return;
}
switch ((BuildResult::Status) res) {
case BuildResult::Built:
result.stepStatus = bsSuccess;
break;
case BuildResult::Substituted:
case BuildResult::AlreadyValid:
result.stepStatus = bsSuccess;
result.isCached = true;
break;
case BuildResult::PermanentFailure:
result.stepStatus = bsFailed;
result.canCache = true;
result.errorMsg = "";
break;
case BuildResult::InputRejected:
case BuildResult::OutputRejected:
result.stepStatus = bsFailed;
result.canCache = true;
break;
case BuildResult::TransientFailure:
result.stepStatus = bsFailed;
result.canRetry = true;
result.errorMsg = "";
break;
case BuildResult::TimedOut:
result.stepStatus = bsTimedOut;
result.errorMsg = "";
break;
case BuildResult::MiscFailure:
result.stepStatus = bsAborted;
result.canRetry = true;
break;
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;