Merge branch '15910-crunch-run-crash'
authorTom Clegg <tclegg@veritasgenetics.com>
Thu, 5 Dec 2019 15:45:02 +0000 (10:45 -0500)
committerTom Clegg <tclegg@veritasgenetics.com>
Thu, 5 Dec 2019 15:45:02 +0000 (10:45 -0500)
refs #15910

Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg@veritasgenetics.com>

build/rails-package-scripts/postinst.sh
build/version-at-commit.sh [new file with mode: 0755]
lib/controller/router/router.go
lib/controller/router/router_test.go
sdk/cli/arvados-cli.gemspec
sdk/ruby/arvados.gemspec
services/api/fpm-info.sh
services/login-sync/arvados-login-sync.gemspec

index 56d55d3276472c43d0fcbd268fefe76b7fb7e6de..a06f8a8e90508d526598941e69826d1d0f90549f 100644 (file)
@@ -186,10 +186,6 @@ configure_version() {
   setup_confdirs /etc/arvados "$CONFIG_PATH"
   setup_conffile environments/production.rb environments/production.rb.example \
       || true
-  setup_conffile application.yml application.yml.example || APPLICATION_READY=0
-  if [ -n "$RAILSPKG_DATABASE_LOAD_TASK" ]; then
-      setup_conffile database.yml database.yml.example || DATABASE_READY=0
-  fi
   setup_extra_conffiles
   echo "... done."
 
@@ -229,7 +225,7 @@ configure_version() {
   fi
 
   if [ 11 = "$RAILSPKG_SUPPORTS_CONFIG_CHECK$APPLICATION_READY" ]; then
-      run_and_report "Checking application.yml for completeness" \
+      run_and_report "Checking configuration for completeness" \
           $COMMAND_PREFIX bundle exec rake config:check || APPLICATION_READY=0
   fi
 
@@ -258,9 +254,9 @@ elif [ "$1" = "0" ] || [ "$1" = "1" ] || [ "$1" = "2" ]; then
   configure_version
 fi
 
-report_not_ready "$DATABASE_READY" "$CONFIG_PATH/database.yml"
 if printf '%s\n' "$CONFIG_PATH" | grep -Fqe "sso"; then
        report_not_ready "$APPLICATION_READY" "$CONFIG_PATH/application.yml"
+       report_not_ready "$DATABASE_READY" "$CONFIG_PATH/database.yml"
 else
        report_not_ready "$APPLICATION_READY" "/etc/arvados/config.yml"
 fi
diff --git a/build/version-at-commit.sh b/build/version-at-commit.sh
new file mode 100755 (executable)
index 0000000..2f514c8
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+set -e -o pipefail
+commit="$1"
+versionglob="[0-9].[0-9]*.[0-9]*"
+
+if ! git describe --exact-match --match "$versionglob" "$commit" 2>/dev/null; then
+    if git merge-base --is-ancestor "$commit" origin/master; then
+        # x.(y+1).0.preTIMESTAMP, where x.y.z is the newest version that does not contain $commit
+        v=$(git tag | grep -vFf <(git tag --contains "$commit") | sort -Vr | head -n1 | perl -pe 's/\.(\d+)\.\d+/".".($1+1).".0"/e')
+    else
+        # x.y.(z+1).preTIMESTAMP, where x.y.z is the latest released ancestor of $commit
+        v=$(git describe --abbrev=0 --match "$versionglob" "$commit" | perl -pe 's/(\d+)$/$1+1/e')
+    fi
+    ts=$(TZ=UTC git log -n1 --format=%cd --date="format-local:%Y%m%d%H%M%S" "$commit")
+    echo "$v.pre$ts"
+fi
index cde6a8e32c40f67fa93abf695d629f8df8957274..a9ed8cab4a3f279253c1e4e6f5854a0f01bbcdee 100644 (file)
@@ -375,7 +375,7 @@ func (rtr *router) ServeHTTP(w http.ResponseWriter, r *http.Request) {
        case "login", "logout", "auth":
        default:
                w.Header().Set("Access-Control-Allow-Origin", "*")
-               w.Header().Set("Access-Control-Allow-Methods", "GET, HEAD, PUT, POST, DELETE")
+               w.Header().Set("Access-Control-Allow-Methods", "GET, HEAD, PUT, POST, PATCH, DELETE")
                w.Header().Set("Access-Control-Allow-Headers", "Authorization, Content-Type")
                w.Header().Set("Access-Control-Max-Age", "86486400")
        }
index b1bc9bce32b202548942dd3869f3ed2073ddaa85..701d53a26c1870d576ad1619bcb880f5a5988c29 100644 (file)
@@ -104,6 +104,14 @@ func (s *RouterSuite) TestOptions(c *check.C) {
                        shouldCall:  "CollectionList",
                        withOptions: arvados.ListOptions{Limit: 123, Offset: 456, IncludeTrash: true, IncludeOldVersions: true},
                },
+               {
+                       method:      "POST",
+                       path:        "/arvados/v1/collections?limit=123",
+                       body:        `{"offset":456,"include_trash":true,"include_old_versions":true}`,
+                       header:      http.Header{"X-Http-Method-Override": {"GET"}, "Content-Type": {"application/json"}},
+                       shouldCall:  "CollectionList",
+                       withOptions: arvados.ListOptions{Limit: 123, Offset: 456, IncludeTrash: true, IncludeOldVersions: true},
+               },
                {
                        method:      "POST",
                        path:        "/arvados/v1/collections?limit=123",
@@ -356,7 +364,7 @@ func (s *RouterIntegrationSuite) TestCORS(c *check.C) {
        for _, hdr := range []string{"Authorization", "Content-Type"} {
                c.Check(rr.Result().Header.Get("Access-Control-Allow-Headers"), check.Matches, ".*"+hdr+".*")
        }
-       for _, method := range []string{"GET", "HEAD", "PUT", "POST", "DELETE"} {
+       for _, method := range []string{"GET", "HEAD", "PUT", "POST", "PATCH", "DELETE"} {
                c.Check(rr.Result().Header.Get("Access-Control-Allow-Methods"), check.Matches, ".*"+method+".*")
        }
 
index 8c8b0a82a4a6e02eb1d140c2195af5dcaae6028c..749797cf848afbd698da32cc7feb7afd00f02d03 100644 (file)
@@ -7,14 +7,13 @@ if not File.exist?('/usr/bin/git') then
   exit
 end
 
-git_latest_tag = `git tag -l |sort -V -r |head -n1`
-git_latest_tag = git_latest_tag.encode('utf-8').strip
+version = `#{__dir__}/../../build/version-at-commit.sh HEAD`.encode('utf-8').strip
 git_timestamp, git_hash = `git log -n1 --first-parent --format=%ct:%H .`.chomp.split(":")
 git_timestamp = Time.at(git_timestamp.to_i).utc
 
 Gem::Specification.new do |s|
   s.name        = 'arvados-cli'
-  s.version     = "#{git_latest_tag}.#{git_timestamp.strftime('%Y%m%d%H%M%S')}"
+  s.version     = version
   s.date        = git_timestamp.strftime("%Y-%m-%d")
   s.summary     = "Arvados CLI tools"
   s.description = "Arvados command line tools, git commit #{git_hash}"
index ef189bb7ac49fd7af7bad9fd313cf3ce942d5ff0..9f314e6c9c0e28d82c3a2e767a04dcb058d8aea5 100644 (file)
@@ -7,14 +7,13 @@ if not File.exist?('/usr/bin/git') then
   exit
 end
 
-git_latest_tag = `git tag -l |sort -V -r |head -n1`
-git_latest_tag = git_latest_tag.encode('utf-8').strip
+version = `#{__dir__}/../../build/version-at-commit.sh HEAD`.encode('utf-8').strip
 git_timestamp, git_hash = `git log -n1 --first-parent --format=%ct:%H .`.chomp.split(":")
 git_timestamp = Time.at(git_timestamp.to_i).utc
 
 Gem::Specification.new do |s|
   s.name        = 'arvados'
-  s.version     = "#{git_latest_tag}.#{git_timestamp.strftime('%Y%m%d%H%M%S')}"
+  s.version     = version
   s.date        = git_timestamp.strftime("%Y-%m-%d")
   s.summary     = "Arvados client library"
   s.description = "Arvados client library, git commit #{git_hash}"
index 1d5891ed62832e4fc761e7005122f5d2b0785fcd..bae128ac7a3d8ec07e3bd21097a741b9eababea7 100644 (file)
@@ -6,9 +6,9 @@ fpm_depends+=('git >= 1.7.10')
 
 case "$TARGET" in
     centos*)
-        fpm_depends+=(libcurl-devel postgresql-devel)
+        fpm_depends+=(libcurl-devel postgresql-devel bison make automake gcc gcc-c++)
         ;;
     debian* | ubuntu*)
-        fpm_depends+=(libcurl-ssl-dev libpq-dev g++)
+        fpm_depends+=(libcurl-ssl-dev libpq-dev g++ bison zlib1g-dev make)
         ;;
 esac
index 36e5ed925283676d28f53a51e021bbfe118925de..f580d529d8a658b2e1a2a57f706aa3bff5fa89e2 100644 (file)
@@ -7,14 +7,13 @@ if not File.exist?('/usr/bin/git') then
   exit
 end
 
-git_latest_tag = `git tag -l |sort -V -r |head -n1`
-git_latest_tag = git_latest_tag.encode('utf-8').strip
+version = `#{__dir__}/../../build/version-at-commit.sh HEAD`.encode('utf-8').strip
 git_timestamp, git_hash = `git log -n1 --first-parent --format=%ct:%H .`.chomp.split(":")
 git_timestamp = Time.at(git_timestamp.to_i).utc
 
 Gem::Specification.new do |s|
   s.name        = 'arvados-login-sync'
-  s.version     = "#{git_latest_tag}.#{git_timestamp.strftime('%Y%m%d%H%M%S')}"
+  s.version     = version
   s.date        = git_timestamp.strftime("%Y-%m-%d")
   s.summary     = "Set up local login accounts for Arvados users"
   s.description = "Creates and updates local login accounts for Arvados users. Built from git commit #{git_hash}"