[ARVADOS] updated: 1.1.1-252-gcb8f4bb

Git user git at public.curoverse.com
Thu Dec 14 11:44:19 EST 2017


Summary of changes:
 doc/_includes/_mount_types.liquid     | 23 +++++++----------------
 sdk/go/arvados/container.go           |  4 +++-
 services/crunch-run/git_mount.go      | 19 +++++++++++++++++--
 services/crunch-run/git_mount_test.go | 20 ++++++++++++++++++--
 4 files changed, 45 insertions(+), 21 deletions(-)

       via  cb8f4bb6e6d11eff6439822b9d3a3e2763eb61be (commit)
       via  1f4e3f1e85bf5b829108f43a61f13cb9801835dd (commit)
      from  4ce855e6b1368cc6ce95c27da2238fa39060c069 (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 cb8f4bb6e6d11eff6439822b9d3a3e2763eb61be
Author: Tom Clegg <tclegg at veritasgenetics.com>
Date:   Thu Dec 14 11:37:10 2017 -0500

    8311: Update docs to describe current implementation.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg at veritasgenetics.com>

diff --git a/doc/_includes/_mount_types.liquid b/doc/_includes/_mount_types.liquid
index 4b0508d..3a10349 100644
--- a/doc/_includes/_mount_types.liquid
+++ b/doc/_includes/_mount_types.liquid
@@ -24,25 +24,16 @@ At container startup, the target path will have the same directory structure as
  "kind":"collection",
  "uuid":"..."
 }</code></pre>|
-|Git tree|@git_tree@|One of { @"git-url"@, @"repository_name"@, @"uuid"@ } must be provided.
-One of { @"commit"@, @"revisions"@ } must be provided.
-"path" may be provided. The default path is "/".
-At container startup, the target path will have the source tree indicated by the given revision. The @.git@ metadata directory _will not_ be available: typically the system will use @git-archive@ rather than @git-checkout@ to prepare the target directory.
-- If a value is given for @"revisions"@, it will be resolved to a set of commits (as desribed in the "ranges" section of git-revisions(1)) and the container request will be satisfiable by any commit in that set.
-- If a value is given for @"commit"@, it will be resolved to a single commit, and the tree resulting from that commit will be used.
-- @"path"@ can be used to select a subdirectory or a single file from the tree indicated by the selected commit.
-- Multiple commits can resolve to the same tree: for example, the file/directory given in @"path"@ might not have changed between commits A and B.
-- The resolved mount (found in the Container record) will have only the "kind" key and a "blob" or "tree" key indicating the 40-character hash of the git tree/blob used.|<pre><code>{
+|Git tree|@git_tree@|@"uuid"@ must be the UUID of an Arvados-hosted git repository.
+@"commit"@ must be a full 40-character commit hash.
+@"path"@, if provided, must be "/".
+At container startup, the target path will have the source tree indicated by the given commit. The @.git@ metadata directory _will not_ be available.
+If @"writable"@ is true, the target directory will be writable. Any changes will be discarded when the container exits.|<pre><code>{
  "kind":"git_tree",
  "uuid":"zzzzz-s0uqq-xxxxxxxxxxxxxxx",
- "commit":"master"
+ "commit":"f315c59f90934cccae6381e72bba59d27ba42099"
 }
-{
- "kind":"git_tree",
- "uuid":"zzzzz-s0uqq-xxxxxxxxxxxxxxx",
- "commit_range":"bugfix^..master",
- "path":"/crunch_scripts/grep"
-}</code></pre>|
+</code></pre>|
 |Temporary directory|@tmp@|@"capacity"@: capacity (in bytes) of the storage device.
 @"device_type"@ (optional, default "network"): one of @{"ram", "ssd", "disk", "network"}@ indicating the acceptable level of performance.
 At container startup, the target path will be empty. When the container finishes, the content will be discarded. This will be backed by a storage mechanism no slower than the specified type.|<pre><code>{

commit 1f4e3f1e85bf5b829108f43a61f13cb9801835dd
Author: Tom Clegg <tclegg at veritasgenetics.com>
Date:   Thu Dec 14 11:26:02 2017 -0500

    8311: Reject invalid/unsupported git mounts. Default to path="/".
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg at veritasgenetics.com>

diff --git a/sdk/go/arvados/container.go b/sdk/go/arvados/container.go
index 16726b7..a541a8d 100644
--- a/sdk/go/arvados/container.go
+++ b/sdk/go/arvados/container.go
@@ -32,7 +32,9 @@ type Mount struct {
 	Content           interface{} `json:"content"`
 	ExcludeFromOutput bool        `json:"exclude_from_output"`
 	Capacity          int64       `json:"capacity"`
-	Commit            string      `json:"commit"` // only if kind=="git_tree"
+	Commit            string      `json:"commit"`          // only if kind=="git_tree"
+	RepositoryName    string      `json:"repository_name"` // only if kind=="git_tree"
+	GitURL            string      `json:"git_url"`         // only if kind=="git_tree"
 }
 
 // RuntimeConstraints specify a container's compute resources (RAM,
diff --git a/services/crunch-run/git_mount.go b/services/crunch-run/git_mount.go
index 110a81b..d24c432 100644
--- a/services/crunch-run/git_mount.go
+++ b/services/crunch-run/git_mount.go
@@ -3,6 +3,7 @@ package main
 import (
 	"fmt"
 	"net/url"
+	"regexp"
 
 	"git.curoverse.com/arvados.git/sdk/go/arvados"
 	"git.curoverse.com/arvados.git/sdk/go/arvadostest"
@@ -16,9 +17,23 @@ import (
 
 type gitMount arvados.Mount
 
+var (
+	sha1re     = regexp.MustCompile(`^[0-9a-f]{40}$`)
+	repoUUIDre = regexp.MustCompile(`^[0-9a-z]{5}-s0uqq-[0-9a-z]{15}$`)
+)
+
 func (gm gitMount) validate() error {
-	if gm.Path != "/" {
-		return fmt.Errorf("cannot mount git_tree path %q -- only \"/\" is supported", gm.Path)
+	if gm.Path != "" && gm.Path != "/" {
+		return fmt.Errorf("cannot mount git_tree with path %q -- only \"/\" is supported", gm.Path)
+	}
+	if !sha1re.MatchString(gm.Commit) {
+		return fmt.Errorf("cannot mount git_tree with commit %q -- must be a 40-char SHA1", gm.Commit)
+	}
+	if gm.RepositoryName != "" || gm.GitURL != "" {
+		return fmt.Errorf("cannot mount git_tree -- repository_name and git_url must be empty")
+	}
+	if !repoUUIDre.MatchString(gm.UUID) {
+		return fmt.Errorf("cannot mount git_tree with uuid %q -- must be a repository UUID", gm.UUID)
 	}
 	return nil
 }
diff --git a/services/crunch-run/git_mount_test.go b/services/crunch-run/git_mount_test.go
index e984000..82dce3a 100644
--- a/services/crunch-run/git_mount_test.go
+++ b/services/crunch-run/git_mount_test.go
@@ -73,7 +73,6 @@ func (s *GitMountSuite) TestextractTree(c *check.C) {
 // reachable in branch "crunch-run-non-tip-test".
 func (s *GitMountSuite) TestExtractNonTipCommit(c *check.C) {
 	gm := gitMount{
-		Path:   "/",
 		UUID:   arvadostest.Repository2UUID,
 		Commit: "5ebfab0522851df01fec11ec55a6d0f4877b542e",
 	}
@@ -134,7 +133,24 @@ func (s *GitMountSuite) TestInvalid(c *check.C) {
 				UUID:   arvadostest.Repository2UUID,
 				Commit: "abc123",
 			},
-			matcher: ".*sha1.*",
+			matcher: ".*SHA1.*",
+		},
+		{
+			gm: gitMount{
+				Path:           "/",
+				UUID:           arvadostest.Repository2UUID,
+				RepositoryName: arvadostest.Repository2Name,
+				Commit:         "5ebfab0522851df01fec11ec55a6d0f4877b542e",
+			},
+			matcher: ".*repository_name.*",
+		},
+		{
+			gm: gitMount{
+				Path:   "/",
+				GitURL: "https://localhost:0/" + arvadostest.Repository2Name + ".git",
+				Commit: "5ebfab0522851df01fec11ec55a6d0f4877b542e",
+			},
+			matcher: ".*git_url.*",
 		},
 		{
 			gm: gitMount{

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list