[ARVADOS] updated: 2.1.0-300-gdba001d20

Git user git at public.arvados.org
Tue Jan 26 21:37:25 UTC 2021


Summary of changes:
 cmd/arvados-client/container_gateway_test.go | 56 ++++++++++++++++++++++++++++
 doc/admin/upgrading.html.textile.liquid      |  9 +++++
 lib/crunchrun/container_gateway.go           |  9 +++--
 3 files changed, 71 insertions(+), 3 deletions(-)

       via  dba001d209d9658cdf0adec182376137c5d65244 (commit)
       via  e6cac792d173f4b4073420aabbb1a506ae966c94 (commit)
      from  87694b32da9e3c8a92f7eedb5c71299d199023fb (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit dba001d209d9658cdf0adec182376137c5d65244
Author: Tom Clegg <tom at curii.com>
Date:   Tue Jan 26 16:36:25 2021 -0500

    17170: Test OpenSSH client -> shell gateway -> docker exec.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at curii.com>

diff --git a/cmd/arvados-client/container_gateway_test.go b/cmd/arvados-client/container_gateway_test.go
index deff7b170..39d6e910b 100644
--- a/cmd/arvados-client/container_gateway_test.go
+++ b/cmd/arvados-client/container_gateway_test.go
@@ -6,9 +6,17 @@ package main
 
 import (
 	"bytes"
+	"context"
+	"crypto/hmac"
+	"crypto/sha256"
+	"fmt"
+	"net/url"
 	"os"
 	"os/exec"
 
+	"git.arvados.org/arvados.git/lib/controller/rpc"
+	"git.arvados.org/arvados.git/lib/crunchrun"
+	"git.arvados.org/arvados.git/sdk/go/arvados"
 	"git.arvados.org/arvados.git/sdk/go/arvadostest"
 	check "gopkg.in/check.v1"
 )
@@ -24,3 +32,51 @@ func (s *ClientSuite) TestShellGatewayNotAvailable(c *check.C) {
 	c.Log(stderr.String())
 	c.Check(stderr.String(), check.Matches, `(?ms).*gateway is not available, container is queued.*`)
 }
+
+func (s *ClientSuite) TestShellGateway(c *check.C) {
+	defer func() {
+		c.Check(arvados.NewClientFromEnv().RequestAndDecode(nil, "POST", "database/reset", nil, nil), check.IsNil)
+	}()
+	uuid := arvadostest.QueuedContainerUUID
+	h := hmac.New(sha256.New, []byte(arvadostest.SystemRootToken))
+	fmt.Fprint(h, uuid)
+	authSecret := fmt.Sprintf("%x", h.Sum(nil))
+	dcid := "theperthcountyconspiracy"
+	gw := crunchrun.Gateway{
+		DockerContainerID: &dcid,
+		ContainerUUID:     uuid,
+		Address:           "0.0.0.0:0",
+		AuthSecret:        authSecret,
+	}
+	err := gw.Start()
+	c.Assert(err, check.IsNil)
+
+	rpcconn := rpc.NewConn("",
+		&url.URL{
+			Scheme: "https",
+			Host:   os.Getenv("ARVADOS_API_HOST"),
+		},
+		true,
+		func(context.Context) ([]string, error) {
+			return []string{arvadostest.SystemRootToken}, nil
+		})
+	_, err = rpcconn.ContainerUpdate(context.TODO(), arvados.UpdateOptions{UUID: uuid, Attrs: map[string]interface{}{
+		"state": arvados.ContainerStateLocked,
+	}})
+	c.Assert(err, check.IsNil)
+	_, err = rpcconn.ContainerUpdate(context.TODO(), arvados.UpdateOptions{UUID: uuid, Attrs: map[string]interface{}{
+		"state":           arvados.ContainerStateRunning,
+		"gateway_address": gw.Address,
+	}})
+	c.Assert(err, check.IsNil)
+
+	var stdout, stderr bytes.Buffer
+	cmd := exec.Command("go", "run", ".", "shell", uuid, "-o", "controlpath=none", "-o", "userknownhostsfile="+c.MkDir()+"/known_hosts", "echo", "ok")
+	cmd.Env = append(cmd.Env, os.Environ()...)
+	cmd.Env = append(cmd.Env, "ARVADOS_API_TOKEN="+arvadostest.ActiveTokenV2)
+	cmd.Stdout = &stdout
+	cmd.Stderr = &stderr
+	c.Check(cmd.Run(), check.NotNil)
+	c.Log(stderr.String())
+	c.Check(stderr.String(), check.Matches, `(?ms).*(No such container: theperthcountyconspiracy|exec: \"docker\": executable file not found in \$PATH).*`)
+}
diff --git a/lib/crunchrun/container_gateway.go b/lib/crunchrun/container_gateway.go
index d234e9341..1116c4bb1 100644
--- a/lib/crunchrun/container_gateway.go
+++ b/lib/crunchrun/container_gateway.go
@@ -259,15 +259,18 @@ func (gw *Gateway) handleSSH(w http.ResponseWriter, req *http.Request) {
 						}
 						cmd.Env = append(os.Environ(), termEnv...)
 						err := cmd.Run()
-						errClose := ch.CloseWrite()
 						var resp struct {
 							Status uint32
 						}
-						if err, ok := err.(*exec.ExitError); ok {
-							if status, ok := err.Sys().(syscall.WaitStatus); ok {
+						if exiterr, ok := err.(*exec.ExitError); ok {
+							if status, ok := exiterr.Sys().(syscall.WaitStatus); ok {
 								resp.Status = uint32(status.ExitStatus())
 							}
+						} else if err != nil {
+							// Propagate errors like `exec: "docker": executable file not found in $PATH`
+							fmt.Fprintln(ch.Stderr(), err)
 						}
+						errClose := ch.CloseWrite()
 						if resp.Status == 0 && (err != nil || errClose != nil) {
 							resp.Status = 1
 						}

commit e6cac792d173f4b4073420aabbb1a506ae966c94
Author: Tom Clegg <tom at curii.com>
Date:   Tue Jan 26 15:43:52 2021 -0500

    17170: Add new Nginx configs to upgrade notes.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at curii.com>

diff --git a/doc/admin/upgrading.html.textile.liquid b/doc/admin/upgrading.html.textile.liquid
index 8317a744a..e0324f6b8 100644
--- a/doc/admin/upgrading.html.textile.liquid
+++ b/doc/admin/upgrading.html.textile.liquid
@@ -39,6 +39,15 @@ h2(#main). development main (as of 2020-12-10)
 
 "Upgrading from 2.1.0":#v2_1_0
 
+h3. New proxy parameters for arvados-controller
+
+In your Nginx configuration file (@/etc/nginx/conf.d/arvados-api-and-controller.conf@), add the following lines to the @location /@ block with @http://controller@ (see "Update nginx configuration":{{site.baseurl}}/install/install-api-server.html#update-nginx for an example) and reload/restart Nginx (@sudo nginx -s reload@).
+
+<pre>
+    proxy_set_header      Upgrade           $http_upgrade;
+    proxy_set_header      Connection        "upgrade";
+</pre>
+
 h3. Changes on the collection's @preserve_version@ attribute semantics
 
 The @preserve_version@ attribute on collections was originally designed to allow clients to persist a preexisting collection version. This forced clients to make 2 requests if the intention is to "make this set of changes in a new version that will be kept", so we have changed the semantics to do just that: When passing @preserve_version=true@ along with other collection updates, the current version is persisted and also the newly created one will be persisted on the next update.

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list