about summary refs log tree commit diff
path: root/scripts/build-remote.pl.in
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2013-05-09T23·09+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2013-05-09T23·09+0200
commit78206f06ecb2f5d6dba85b5f709251030e966f1c (patch)
tree4512467b9f1b3409b655d20793c6535d90a7f38a /scripts/build-remote.pl.in
parent2ee9da9e22ecaad1cc5ad0f940e7b079a9e62cfa (diff)
build-remote.pl: Allow a machine to refuse a build
Before selecting a machine, build-remote.pl will try to run the
command "nix-builds-inhibited" on the machine.  If this command exists
and returns a 0 exit code, then the machine won't be used.  It's up to
the user to provide this command, but it would typically be a script
that checks whether there is enough disk space and whether the load is
not too high.
Diffstat (limited to 'scripts/build-remote.pl.in')
-rwxr-xr-xscripts/build-remote.pl.in4
1 files changed, 3 insertions, 1 deletions
diff --git a/scripts/build-remote.pl.in b/scripts/build-remote.pl.in
index e7e7538793..6be4c45ebd 100755
--- a/scripts/build-remote.pl.in
+++ b/scripts/build-remote.pl.in
@@ -195,7 +195,9 @@ REQ: while (1) {
         # Connect to the selected machine.
         @sshOpts = ("-i", $machine->{sshKeys}, "-x");
         $hostName = $machine->{hostName};
-        last REQ if openSSHConnection $hostName;
+        last REQ if
+            openSSHConnection($hostName) &&
+            system("ssh $hostName @sshOpts nix-builds-inhibited >/dev/null 2>&1") != 0;
 
         warn "unable to open SSH connection to $hostName, trying other available machines...\n";
         $machine->{enabled} = 0;