Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into nix-ca
Browse files Browse the repository at this point in the history
  • Loading branch information
Ericson2314 committed Dec 10, 2023
2 parents 049f608 + 411e4d0 commit 4ba5179
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 31 deletions.
49 changes: 19 additions & 30 deletions src/hydra-queue-runner/build-remote.cc
Original file line number Diff line number Diff line change
Expand Up @@ -310,9 +310,6 @@ static BuildResult performBuild(
counter & nrStepsBuilding
)
{

BuildResult result;

conn.to << ServeProto::Command::BuildDerivation << localStore.printStorePath(drvPath);
writeDerivation(conn.to, localStore, drv);
conn.to << options.maxSilentTime << options.buildTimeout;
Expand All @@ -325,39 +322,31 @@ static BuildResult performBuild(
}
conn.to.flush();

result.startTime = time(0);
BuildResult result;

time_t startTime, stopTime;

startTime = time(0);
{
MaintainCount<counter> mc(nrStepsBuilding);
result.status = (BuildResult::Status)readInt(conn.from);
result = ServeProto::Serialise<BuildResult>::read(localStore, conn);
}
result.stopTime = time(0);


result.errorMsg = readString(conn.from);
if (GET_PROTOCOL_MINOR(conn.remoteVersion) >= 3) {
result.timesBuilt = readInt(conn.from);
result.isNonDeterministic = readInt(conn.from);
auto start = readInt(conn.from);
auto stop = readInt(conn.from);
if (start && start) {
/* Note: this represents the duration of a single
round, rather than all rounds. */
result.startTime = start;
result.stopTime = stop;
}
stopTime = time(0);

if (!result.startTime) {
// If the builder gave `startTime = 0`, use our measurements
// instead of the builder's.
//
// Note: this represents the duration of a single round, rather
// than all rounds.
result.startTime = startTime;
result.stopTime = stopTime;
}

// Get the newly built outputs, either from the remote if it
// supports it, or by introspecting the derivation if the remote is
// too old.
if (GET_PROTOCOL_MINOR(conn.remoteVersion) >= 6) {
auto builtOutputs = ServeProto::Serialise<DrvOutputs>::read(localStore, conn);
for (auto && [output, realisation] : builtOutputs)
result.builtOutputs.insert_or_assign(
std::move(output.outputName),
std::move(realisation));
} else {
// If the protocol was too old to give us `builtOutputs`, initialize
// it manually by introspecting the derivation.
if (GET_PROTOCOL_MINOR(conn.remoteVersion) < 6)
{
// If the remote is too old to handle CA derivations, we can’t get this
// far anyways
assert(drv.type().hasKnownOutputPaths());
Expand Down
4 changes: 3 additions & 1 deletion t/lib/HydraTestContext.pm
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ sub new {

my $deststoredir;

my $dir = File::Temp->newdir();
# Cleanup will be managed by yath. By the default it will be cleaned
# up, but can be kept to aid in debugging test failures.
my $dir = File::Temp->newdir(CLEANUP => 0);

$ENV{'HYDRA_DATA'} = "$dir/hydra-data";
mkdir $ENV{'HYDRA_DATA'};
Expand Down

0 comments on commit 4ba5179

Please sign in to comment.