Fix arvados-login-sync for vm account creation
[arvados.git] / jenkins / run-build-packages-one-target.sh
index afb6effa9e5204391da9e7f7cc34c42899c2d227..95977030fcec0ed01aad02a965c98aa0cac6151a 100755 (executable)
@@ -14,11 +14,15 @@ Syntax:
     Run package install test script "test-packages-$target.sh"
 --debug
     Output debug information (default: false)
+--only-test
+    Test only a specific package
 
 WORKSPACE=path         Path to the Arvados source tree to build packages from
 
 EOF
 
+set -e
+
 if ! [[ -n "$WORKSPACE" ]]; then
   echo >&2 "$helpmessage"
   echo >&2
@@ -36,7 +40,7 @@ if ! [[ -d "$WORKSPACE" ]]; then
 fi
 
 PARSEDOPTS=$(getopt --name "$0" --longoptions \
-    help,debug,test-packages,target:,command: \
+    help,debug,test-packages,target:,command:,only-test: \
     -- "" "$@")
 if [ $? -ne 0 ]; then
     exit 1
@@ -57,6 +61,9 @@ while [ $# -gt 0 ]; do
         --target)
             TARGET="$2"; shift
             ;;
+        --only-test)
+            packages="$2"; shift
+            ;;
         --debug)
             DEBUG=" --debug"
             ;;
@@ -89,7 +96,7 @@ if [[ -n "$test_packages" ]]; then
         )
     fi
 
-    COMMAND="/jenkins/test-packages-$TARGET.sh"
+    COMMAND="/jenkins/package-testing/test-packages-$TARGET.sh"
     IMAGE="arvados/package-test:$TARGET"
 else
     IMAGE="arvados/build:$TARGET"
@@ -103,7 +110,8 @@ JENKINS_DIR=$(dirname "$(readlink -e "$0")")
 if [[ -n "$test_packages" ]]; then
     pushd "$JENKINS_DIR/package-test-dockerfiles"
 else
-    pushd "$JENKINS_DIR/dockerfiles"
+    pushd "$JENKINS_DIR/package-build-dockerfiles"
+    make "$TARGET/generated"
 fi
 
 echo $TARGET
@@ -111,7 +119,8 @@ cd $TARGET
 time docker build --tag=$IMAGE .
 popd
 
-packages="arvados-api-server
+if test -z "$packages" ; then
+    packages="arvados-api-server
         arvados-data-manager
         arvados-docker-cleaner
         arvados-git-httpd
@@ -123,29 +132,51 @@ packages="arvados-api-server
         keep-rsync
         keepstore
         keep-web
-        libarvados-perl
-        python27-python-arvados-fuse
-        python27-python-arvados-python-client"
+        libarvados-perl"
+
+    case "$TARGET" in
+        centos6)
+            packages="$packages python27-python-arvados-fuse
+                  python27-python-arvados-python-client"
+        ;;
+        *)
+            packages="$packages python-arvados-fuse
+                  python-arvados-python-client"
+            ;;
+    esac
+fi
 
 FINAL_EXITCODE=0
 
+package_fails=""
+
 if [[ -n "$test_packages" ]]; then
     for p in $packages ; do
-        if ! docker run --rm -v "$JENKINS_DIR:/jenkins" -v "$WORKSPACE:/arvados" \
-                  --env ARVADOS_DEBUG=1 "$IMAGE" $COMMAND $p ; then
+        if docker run --rm -v "$JENKINS_DIR:/jenkins" -v "$WORKSPACE:/arvados" \
+               --env ARVADOS_DEBUG=1 \
+               --env "TARGET=$TARGET" \
+               --env "WORKSPACE=/arvados" \
+               "$IMAGE" $COMMAND $p ; then
+            true
+        else
             FINAL_EXITCODE=$?
-            echo "ERROR: $tag build failed with exit status $FINAL_EXITCODE." >&2
+            package_fails="$package_fails $p"
+            echo "ERROR: $tag test failed with exit status $FINAL_EXITCODE." >&2
         fi
     done
 else
     if docker run --rm -v "$JENKINS_DIR:/jenkins" -v "$WORKSPACE:/arvados" \
-              --env ARVADOS_DEBUG=1 "$IMAGE" $COMMAND; then
-        # Success - nothing more to do.
-        true
+           --env ARVADOS_DEBUG=1 "$IMAGE" $COMMAND ; then
+        echo
+        echo "Build packages for $TARGET succeeded." >&2
     else
         FINAL_EXITCODE=$?
         echo "ERROR: $tag build failed with exit status $FINAL_EXITCODE." >&2
     fi
 fi
 
+if test -n "$package_fails" ; then
+    echo "Failed package tests:$package_fails" >&2
+fi
+
 exit $FINAL_EXITCODE