Skip to content

Commit 4b8f74b

Browse files
authored
Merge pull request #13320 from DeterminateSystems/keep-failed-remote-builders-warning
Clarify that `--keep-failed` with remote builders will keep the failed build directory on that builder
2 parents 6a761c1 + 54aa73b commit 4b8f74b

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/build-remote/build-remote.cc

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,8 +329,17 @@ static int main_build_remote(int argc, char * * argv)
329329
drv.inputSrcs = store->parseStorePathSet(inputs);
330330
optResult = sshStore->buildDerivation(*drvPath, (const BasicDerivation &) drv);
331331
auto & result = *optResult;
332-
if (!result.success())
332+
if (!result.success()) {
333+
if (settings.keepFailed) {
334+
warn(
335+
"The failed build directory was kept on the remote builder due to `--keep-failed`.%s",
336+
(settings.thisSystem == drv.platform || settings.extraPlatforms.get().count(drv.platform) > 0)
337+
? " You can re-run the command with `--builders ''` to disable remote building for this invocation."
338+
: ""
339+
);
340+
}
333341
throw Error("build of '%s' on '%s' failed: %s", store->printStorePath(*drvPath), storeUri, result.errorMsg);
342+
}
334343
} else {
335344
copyClosure(*store, *sshStore, StorePathSet {*drvPath}, NoRepair, NoCheckSigs, substitute);
336345
auto res = sshStore->buildPathsWithResults({

tests/functional/build-remote.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ out="$(nix-build 2>&1 failing.nix \
8585
--arg busybox "$busybox")" || true
8686

8787
[[ "$out" =~ .*"note: keeping build directory".* ]]
88+
[[ "$out" =~ .*"The failed build directory was kept on the remote builder due to".* ]]
8889

8990
build_dir="$(grep "note: keeping build" <<< "$out" | sed -E "s/^(.*)note: keeping build directory '(.*)'(.*)$/\2/")"
9091
[[ "foo" = $(<"$build_dir"/bar) ]]

0 commit comments

Comments
 (0)