From bd8345777f5a48ee61656248655ebac71a09e926 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 9 Dec 2016 14:54:42 +0100 Subject: offload: Do not read ~/.ssh/known_hosts. * guix/scripts/offload.scm (open-ssh-session): Pass #:knownhosts to 'make-session'. --- guix/scripts/offload.scm | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'guix') diff --git a/guix/scripts/offload.scm b/guix/scripts/offload.scm index ebff11664d..f25cc5e7bb 100644 --- a/guix/scripts/offload.scm +++ b/guix/scripts/offload.scm @@ -177,6 +177,14 @@ (define (open-ssh-session machine) ;; #:log-verbosity 'protocol #:identity (build-machine-private-key machine) + ;; By default libssh reads ~/.ssh/known_hosts + ;; and uses that to adjust its choice of cipher + ;; suites, which changes the type of host key + ;; that the server sends (RSA vs. Ed25519, + ;; etc.). Opt for something reproducible and + ;; stateless instead. + #:knownhosts "/dev/null" + ;; We need lightweight compression when ;; exchanging full archives. #:compression -- cgit v1.2.3 From 2b513387cd63f82afc8fb6a076674b323e964b7f Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 9 Dec 2016 23:00:08 +0100 Subject: offload: Test each machine only once. * guix/scripts/offload.scm (check-machine-availability)[build-machine=?]: New procedure. Add call to 'delete-duplicates'. --- guix/scripts/offload.scm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'guix') diff --git a/guix/scripts/offload.scm b/guix/scripts/offload.scm index f25cc5e7bb..f56220ff69 100644 --- a/guix/scripts/offload.scm +++ b/guix/scripts/offload.scm @@ -710,7 +710,14 @@ (define (assert-node-can-export node name daemon-socket) (define (check-machine-availability machine-file) "Check that each machine in MACHINE-FILE is usable as a build machine." - (let ((machines (build-machines machine-file))) + (define (build-machine=? m1 m2) + (and (string=? (build-machine-name m1) (build-machine-name m2)) + (= (build-machine-port m1) (build-machine-port m2)))) + + ;; A given build machine may appear several times (e.g., once for + ;; "x86_64-linux" and a second time for "i686-linux"); test them only once. + (let ((machines (delete-duplicates (build-machines machine-file) + build-machine=?))) (info (_ "testing ~a build machines defined in '~a'...~%") (length machines) machine-file) (let* ((names (map build-machine-name machines)) -- cgit v1.2.3 From 27991c97e64c95be4cae7f2b0a843565df329215 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 9 Dec 2016 23:12:06 +0100 Subject: offload: Allow testing machines that match a regexp. * guix/scripts/offload.scm (check-machine-availability): Add 'pred' parameter and honor it. (guix-offload): for the "test" sub-command, accept an extra 'regexp' parameter. Pass a second argument to 'check-machine-availability'. --- doc/guix.texi | 6 ++++++ guix/scripts/offload.scm | 25 ++++++++++++++++--------- 2 files changed, 22 insertions(+), 9 deletions(-) (limited to 'guix') diff --git a/doc/guix.texi b/doc/guix.texi index 71de73b953..0cb1bc7665 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -1005,6 +1005,12 @@ command line: # guix offload test machines-qualif.scm @end example +Last, you can test the subset of the machines whose name matches a +regular expression like this: + +@example +# guix offload test machines.scm '\.gnu\.org$' +@end example @node Invoking guix-daemon @section Invoking @command{guix-daemon} diff --git a/guix/scripts/offload.scm b/guix/scripts/offload.scm index f56220ff69..c98cf8c534 100644 --- a/guix/scripts/offload.scm +++ b/guix/scripts/offload.scm @@ -708,16 +708,18 @@ (define (assert-node-can-export node name daemon-socket) (leave (_ "failed to import '~a' from '~a'~%") item name))))) -(define (check-machine-availability machine-file) - "Check that each machine in MACHINE-FILE is usable as a build machine." +(define (check-machine-availability machine-file pred) + "Check that each machine matching PRED in MACHINE-FILE is usable as a build +machine." (define (build-machine=? m1 m2) (and (string=? (build-machine-name m1) (build-machine-name m2)) (= (build-machine-port m1) (build-machine-port m2)))) ;; A given build machine may appear several times (e.g., once for ;; "x86_64-linux" and a second time for "i686-linux"); test them only once. - (let ((machines (delete-duplicates (build-machines machine-file) - build-machine=?))) + (let ((machines (filter pred + (delete-duplicates (build-machines machine-file) + build-machine=?)))) (info (_ "testing ~a build machines defined in '~a'...~%") (length machines) machine-file) (let* ((names (map build-machine-name machines)) @@ -781,11 +783,16 @@ (define not-coma (loop (read-line))))))) (("test" rest ...) (with-error-handling - (let ((file (match rest - ((file) file) - (() %machine-file) - (_ (leave (_ "wrong number of arguments~%")))))) - (check-machine-availability (or file %machine-file))))) + (let-values (((file pred) + (match rest + ((file regexp) + (values file + (compose (cut string-match regexp <>) + build-machine-name))) + ((file) (values file (const #t))) + (() (values %machine-file (const #t))) + (_ (leave (_ "wrong number of arguments~%")))))) + (check-machine-availability (or file %machine-file) pred)))) (("--version") (show-version-and-exit "guix offload")) (("--help") -- cgit v1.2.3