[ARVADOS] updated: 2.1.0-105-ge9eaf87ec

Git user git at public.arvados.org
Tue Nov 24 20:19:05 UTC 2020


Summary of changes:
 tools/salt-install/provision.sh      | 33 +++++++++++------------
 tools/salt-install/tests/run-test.sh | 51 ++++++++++++++++++++++++------------
 2 files changed, 49 insertions(+), 35 deletions(-)

       via  e9eaf87eca20700a7230631eaf6b68852daeda5a (commit)
      from  cc9b9dac7be9c0bbf1d8e227466e9c71a7b3d35e (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 e9eaf87eca20700a7230631eaf6b68852daeda5a
Author: Javier Bértoli <jbertoli at curii.com>
Date:   Tue Nov 24 17:17:25 2020 -0300

    Fix salt-install and test scripts
    
    * add checks to find existing resources
    * run some shellcheck
    
    refs #17146, #17147, #17150
    
    Arvados-DCO-1.1-Signed-off-by: Javier Bértoli <jbertoli at curii.com>

diff --git a/tools/salt-install/provision.sh b/tools/salt-install/provision.sh
index 57a26308e..91cb39894 100755
--- a/tools/salt-install/provision.sh
+++ b/tools/salt-install/provision.sh
@@ -1,4 +1,4 @@
-#!/bin/bash -x
+#!/bin/bash 
 
 # Copyright (C) The Arvados Authors. All rights reserved.
 #
@@ -55,9 +55,9 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
 
 usage() {
   echo >&2
-  echo >&2 "Usage: $0 [-h] [-h]"
+  echo >&2 "Usage: ${0} [-h] [-h]"
   echo >&2
-  echo >&2 "$0 options:"
+  echo >&2 "${0} options:"
   echo >&2 "  -d, --debug             Run salt installation in debug mode"
   echo >&2 "  -p <N>, --ssl-port <N>  SSL port to use for the web applications"
   echo >&2 "  -t, --test              Test installation running a CWL workflow"
@@ -68,16 +68,16 @@ usage() {
 
 arguments() {
   # NOTE: This requires GNU getopt (part of the util-linux package on Debian-based distros).
-  TEMP=`getopt -o dhp:tv \
+  TEMP=$(getopt -o dhp:tv \
     --long debug,help,ssl-port:,test,vagrant \
-    -n "$0" -- "$@"`
+    -n "${0}" -- "${@}")
 
-  if [ $? != 0 ] ; then echo "GNU getopt missing? Use -h for help"; exit 1 ; fi
+  if [ ${?} != 0 ] ; then echo "GNU getopt missing? Use -h for help"; exit 1 ; fi
   # Note the quotes around `$TEMP': they are essential!
   eval set -- "$TEMP"
 
-  while [ $# -ge 1 ]; do
-    case $1 in
+  while [ ${#} -ge 1 ]; do
+    case ${1} in
       -d | --debug)
         LOG_LEVEL="debug"
         shift
@@ -110,7 +110,7 @@ LOG_LEVEL="info"
 HOST_SSL_PORT=443
 TESTS_DIR="tests"
 
-arguments $@
+arguments ${@}
 
 # Salt's dir
 ## states
@@ -185,18 +185,15 @@ EOFPSLS
 # Get the formula and dependencies
 cd ${F_DIR} || exit 1
 for f in postgres arvados nginx docker locale; do
-  git clone https://github.com/netmanagers/${f}-formula.git
+  git clone https://github.com/saltstack-formulas/${f}-formula.git
 done
 
 if [ "x${BRANCH}" != "x" ]; then
-  cd ${F_DIR}/arvados-formula
-  git checkout -t origin/${BRANCH}
+  cd ${F_DIR}/arvados-formula || exit 1
+  git checkout -t origin/"${BRANCH}"
   cd -
 fi
 
-# sed "s/__DOMAIN__/${DOMAIN}/g; s/__CLUSTER__/${CLUSTER}/g; s/__RELEASE__/${RELEASE}/g; s/__VERSION__/${VERSION}/g" \
-#   ${CONFIG_DIR}/arvados_dev.sls > ${P_DIR}/arvados.sls
-
 if [ "x${VAGRANT}" = "xyes" ]; then
   SOURCE_PILLARS_DIR="/vagrant/${CONFIG_DIR}"
   TESTS_DIR="/vagrant/${TESTS_DIR}"
@@ -206,7 +203,7 @@ else
 fi
 
 # Replace cluster and domain name in the example pillars and test files
-for f in ${SOURCE_PILLARS_DIR}/*; do
+for f in "${SOURCE_PILLARS_DIR}"/*; do
   sed "s/__CLUSTER__/${CLUSTER}/g;
        s/__DOMAIN__/${DOMAIN}/g;
        s/__RELEASE__/${RELEASE}/g;
@@ -216,12 +213,12 @@ for f in ${SOURCE_PILLARS_DIR}/*; do
        s/__INITIAL_USER_EMAIL__/${INITIAL_USER_EMAIL}/g;
        s/__INITIAL_USER_PASSWORD__/${INITIAL_USER_PASSWORD}/g;
        s/__VERSION__/${VERSION}/g" \
-  ${f} > ${P_DIR}/$(basename ${f})
+  "${f}" > "${P_DIR}"/$(basename "${f}")
 done
 
 mkdir -p /tmp/cluster_tests
 # Replace cluster and domain name in the example pillars and test files
-for f in ${TESTS_DIR}/*; do
+for f in "${TESTS_DIR}"/*; do
   sed "s/__CLUSTER__/${CLUSTER}/g;
        s/__DOMAIN__/${DOMAIN}/g;
        s/__HOST_SSL_PORT__/${HOST_SSL_PORT}/g;
diff --git a/tools/salt-install/tests/run-test.sh b/tools/salt-install/tests/run-test.sh
index b91101ee1..a4614aa8b 100755
--- a/tools/salt-install/tests/run-test.sh
+++ b/tools/salt-install/tests/run-test.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/env /bin/bash
+#!/bin/bash
 # Copyright (C) The Arvados Authors. All rights reserved.
 #
 # SPDX-License-Identifier: Apache-2.0
@@ -11,32 +11,49 @@ export ARVADOS_API_HOST_INSECURE=true
 # https://doc.arvados.org/v2.0/install/install-jobs-image.html
 echo "Creating Arvados Standard Docker Images project"
 uuid_prefix=$(arv --format=uuid user current | cut -d- -f1)
-project_uuid=$(arv --format=uuid group create --group "{\"owner_uuid\": \"${uuid_prefix}-tpzed-000000000000000\", \"group_class\":\"project\", \"name\":\"Arvados Standard Docker Images\"}")
-echo "Arvados project uuid is '${project_uuid}'"
-read -rd $'\000' newlink <<EOF; arv link create --link "${newlink}"
+project_uuid=$(arv --format=uuid group list --filters '[["name", "=", "Arvados Standard Docker Images"]]')
+
+if [ "x${project_uuid}" = "x" ]; then
+  project_uuid=$(arv --format=uuid group create --group "{\"owner_uuid\": \"${uuid_prefix}-tpzed-000000000000000\", \"group_class\":\"project\", \"name\":\"Arvados Standard Docker Images\"}")
+
+  read -rd $'\000' newlink <<EOF; arv link create --link "${newlink}"
 {
-"tail_uuid":"${uuid_prefix}-j7d0g-fffffffffffffff",
-"head_uuid":"${project_uuid}",
-"link_class":"permission",
-"name":"can_read"
+  "tail_uuid":"${uuid_prefix}-j7d0g-fffffffffffffff",
+  "head_uuid":"${project_uuid}",
+  "link_class":"permission",
+  "name":"can_read"
 }
 EOF
+fi
+
+echo "Arvados project uuid is '${project_uuid}'"
 
 echo "Uploading arvados/jobs' docker image to the project"
 VERSION="2.1.1"
-arv-keepdocker --pull arvados/jobs ${VERSION} --project-uuid ${project_uuid}
+arv-keepdocker --pull arvados/jobs "${VERSION}" --project-uuid "${project_uuid}"
 
 # Create the initial user
-echo "Creating initial user ('__INITIAL_USER__')"
-user=$(arv --format=uuid user create --user '{"email": "__INITIAL_USER_EMAIL__", "username": "__INITIAL_USER__"}')
-echo "Setting up user ('__INITIAL_USER__')"
-arv user setup --uuid ${user}
+echo "Creating initial user '__INITIAL_USER__'"
+user_uuid=$(arv --format=uuid user list --filters '[["email", "=", "admin at arva2.arv.local"], ["username", "=", "admin"]]')
+
+if [ "x${user_uuid}" = "x" ]; then
+  user_uuid=$(arv --format=uuid user create --user '{"email": "__INITIAL_USER_EMAIL__", "username": "__INITIAL_USER__"}')
+  echo "Setting up user '__INITIAL_USER__'"
+  arv user setup --uuid "${user_uuid}"
+fi
+
 echo "Activating user '__INITIAL_USER__'"
-arv user update --uuid ${user} --user '{"is_active": true}'
+arv user update --uuid "${user_uuid}" --user '{"is_active": true}'
 
-user_api_token=$(arv api_client_authorization create --api-client-authorization "{\"owner_uuid\": \"${user}\"}" | jq -r .api_token)
+echo "Getting the user API TOKEN"
+user_api_token=$(arv api_client_authorization list --filters "[[\"owner_uuid\", \"=\", \"${user_uuid}\"],[\"kind\", \"==\", \"arvados#apiClientAuthorization\"]]" --limit=1 |jq -r .items[].api_token)
+
+if [ "x${user_uuid}" = "x" ]; then
+  user_api_token=$(arv api_client_authorization create --api-client-authorization "{\"owner_uuid\": \"${user_uuid}\"}" | jq -r .api_token)
+fi
 
-echo "Running test CWL workflow"
 # Change to the user's token and run the workflow
-export ARVADOS_API_TOKEN=${user_api_token}
+export ARVADOS_API_TOKEN="${user_api_token}"
+
+echo "Running test CWL workflow"
 cwl-runner hasher-workflow.cwl hasher-workflow-job.yml

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list