summary refs log tree commit diff
path: root/scripts
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2009-01-13 11:39:09 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2009-01-13 11:39:09 +0000
commit019176137f49eba826e08c6b0f0a5c35ecdde81d (patch)
treeb1e8adb454924d8e1a3e64e8a517090ae33a4f88 /scripts
parent4ce692df88b4a9b32767ee6c0223d789d83712cc (diff)
downloadguix-019176137f49eba826e08c6b0f0a5c35ecdde81d.tar.gz
* 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). 

Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/build-remote.pl.in12
1 files changed, 10 insertions, 2 deletions
diff --git a/scripts/build-remote.pl.in b/scripts/build-remote.pl.in
index 930164599a..53cf536447 100755
--- a/scripts/build-remote.pl.in
+++ b/scripts/build-remote.pl.in
@@ -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";