mirror of
https://github.com/NixOS/nix
synced 2025-07-07 10:11:47 +02:00
* When using a build hook, distinguish between transient failures
(e.g. an SSH connection problem) and permanent failures (i.e. the builder failed). This matters to Hydra (it wants to know whether it makes sense to retry a build).
This commit is contained in:
parent
4ce692df88
commit
019176137f
2 changed files with 30 additions and 6 deletions
|
@ -192,8 +192,16 @@ my $buildFlags = "--max-silent-time $maxSilentTime";
|
|||
# connection dies. Without it, the remote process might continue to
|
||||
# run indefinitely (that is, until it next tries to write to
|
||||
# stdout/stderr).
|
||||
system("ssh -tt $sshOpts $hostName 'nix-store -rvvK $buildFlags $drvPath'") == 0
|
||||
or die "remote build on $hostName failed: $?";
|
||||
if (system("ssh -tt $sshOpts $hostName 'nix-store -rvvK $buildFlags $drvPath'") != 0) {
|
||||
# If we couldn't run ssh or there was an ssh problem (indicated by
|
||||
# exit code 255), then we return exit code 1; otherwise we assume
|
||||
# that the builder failed, which we indicated to Nix using exit
|
||||
# code 100. It's important to distinguish between the two because
|
||||
# the first is a transient failure and the latter is permanent.
|
||||
my $res = $? == -1 || ($? >> 8) == 255 ? 1 : 100;
|
||||
print STDERR "remote build on $hostName failed: $?";
|
||||
exit $res;
|
||||
}
|
||||
|
||||
print "REMOTE BUILD DONE: $drvPath on $hostName\n";
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue