[arvados] created: 2.7.0-5983-g2587b1c222

git repository hosting git at public.arvados.org
Tue Feb 6 05:00:21 UTC 2024


        at  2587b1c222325056153b666deed727fdcc43b681 (commit)


commit 2587b1c222325056153b666deed727fdcc43b681
Author: Peter Amstutz <peter.amstutz at curii.com>
Date:   Mon Feb 5 23:28:08 2024 -0500

    21451: Launcher script for running test suite in docker
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz at curii.com>

diff --git a/tools/arvbox/bin/arvbox b/tools/arvbox/bin/arvbox
index 13583ba288..01e2758e4f 100755
--- a/tools/arvbox/bin/arvbox
+++ b/tools/arvbox/bin/arvbox
@@ -381,6 +381,8 @@ build() {
 
     if test "$1" = localdemo -o "$1" = publicdemo ; then
         BUILDTYPE=demo
+    elif test "$1" = test ; then
+        BUILDTYPE=test
     else
         BUILDTYPE=dev
     fi
@@ -389,14 +391,16 @@ build() {
 	ARVADOS_BRANCH=$GITHEAD
     fi
 
-    docker build --build-arg=BUILDTYPE=$BUILDTYPE $NO_CACHE \
-	   --build-arg=go_version=$GO_VERSION \
-	   --build-arg=arvados_version=$ARVADOS_BRANCH \
-	   --build-arg=workdir=/tools/arvbox/lib/arvbox/docker \
-	   -t arvados/arvbox-base:$GITHEAD \
-	   -f "$ARVBOX_DOCKER/Dockerfile.base" \
-	   "$LOCAL_ARVADOS_ROOT"
-    docker tag $FORCE arvados/arvbox-base:$GITHEAD arvados/arvbox-base:latest
+    if test "$BUILD_BASE" != skip ; then
+	docker build --build-arg=BUILDTYPE=$BUILDTYPE $NO_CACHE \
+	       --build-arg=go_version=$GO_VERSION \
+	       --build-arg=arvados_version=$ARVADOS_BRANCH \
+	       --build-arg=workdir=/tools/arvbox/lib/arvbox/docker \
+	       -t arvados/arvbox-base:$GITHEAD \
+	       -f "$ARVBOX_DOCKER/Dockerfile.base" \
+	       "$LOCAL_ARVADOS_ROOT"
+	docker tag $FORCE arvados/arvbox-base:$GITHEAD arvados/arvbox-base:latest
+    fi
     docker build $NO_CACHE \
 	   --build-arg=go_version=$GO_VERSION \
 	   --build-arg=arvados_version=$ARVADOS_BRANCH \
@@ -436,6 +440,11 @@ case "$subcmd" in
         build $@
         ;;
 
+    quickbuild)
+        check $@
+        BUILD_BASE=skip build $@
+        ;;
+
     rebuild)
         check $@
         NO_CACHE=--no-cache build $@
diff --git a/tools/arvbox/lib/arvbox/docker/Dockerfile.dev b/tools/arvbox/lib/arvbox/docker/Dockerfile.dev
index e3d18edd62..cbc5c3b411 100644
--- a/tools/arvbox/lib/arvbox/docker/Dockerfile.dev
+++ b/tools/arvbox/lib/arvbox/docker/Dockerfile.dev
@@ -10,6 +10,8 @@ RUN ln -sf /var/lib/arvbox/service /etc
 RUN mkdir -p $ARVADOS_CONTAINER_PATH
 RUN echo "development" > $ARVADOS_CONTAINER_PATH/api_rails_env
 
+ADD testlauncher.sh /usr/local/bin
+
 RUN mkdir /etc/test-service && \
     ln -sf /var/lib/arvbox/service/postgres /etc/test-service && \
     ln -sf /var/lib/arvbox/service/certificate /etc/test-service
diff --git a/tools/arvbox/lib/arvbox/docker/testlauncher.sh b/tools/arvbox/lib/arvbox/docker/testlauncher.sh
new file mode 100755
index 0000000000..a5d91470da
--- /dev/null
+++ b/tools/arvbox/lib/arvbox/docker/testlauncher.sh
@@ -0,0 +1,52 @@
+#!/bin/sh
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+set -xeu
+
+PGVERSION=$(psql --version | grep -E -o '[0-9]+' | head -n1)
+
+make-ssl-cert generate-default-snakeoil --force-overwrite
+
+chown -R postgres:postgres /etc/ssl/private
+chmod 0600 /etc/ssl/private/ssl-cert-snakeoil.key
+
+su postgres -c "/usr/lib/postgresql/$PGVERSION/bin/postgres -D /var/lib/postgresql/$PGVERSION/main -c config_file=/etc/postgresql/$PGVERSION/main/postgresql.conf" &
+
+database_pw=insecure_test_password
+
+sleep 1
+
+su postgres -c "psql postgres -c \"create user arvados with password '$database_pw'\""
+su postgres -c "psql postgres -c \"ALTER USER arvados WITH SUPERUSER;\""
+
+ARVADOS_CONTAINER_PATH=/var/lib/arvados-arvbox
+
+mkdir -p $ARVADOS_CONTAINER_PATH/run_tests
+cat >$ARVADOS_CONTAINER_PATH/run_tests/config.yml <<EOF
+Clusters:
+  zzzzz:
+    PostgreSQL:
+      Connection:
+        host: localhost
+        user: arvados
+        password: ${database_pw}
+        dbname: arvados_test
+        client_encoding: utf8
+EOF
+
+useradd --home-dir /home/arvbox --create-home arvbox
+
+su arvbox -c env
+su arvbox -c "ls -l /home"
+
+export CONFIGSRC=$ARVADOS_CONTAINER_PATH/run_tests
+
+while ! su arvbox -c "psql postgres -c\\\du >/dev/null 2>/dev/null" ; do
+    sleep 1
+done
+
+export WORKSPACE=/usr/src/arvados
+
+exec su arvbox -c "/usr/src/arvados/build/run-tests.sh --temp /home/arvbox $@"

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list