Merge branch 'thehyve/fix-crunch-documentation' Fix a typo in Crunch Dispatch install...
[arvados.git] / build / run-build-packages-one-target.sh
index ef7862c8d686c004651a5b22044898802710e327..900a5e25efc6ab024640be8950889a4ec2ac2152 100755 (executable)
@@ -21,8 +21,12 @@ Syntax:
     Build only a specific package
 --only-test <package>
     Test only a specific package
+--force-test
+    Test even if there is no new untested package
 --build-version <string>
-    Version to build (default: \$ARVADOS_BUILDING_VERSION or 0.1.timestamp.commithash)
+    Version to build (default:
+    \$ARVADOS_BUILDING_VERSION-\$ARVADOS_BUILDING_ITERATION or
+    0.1.timestamp.commithash)
 
 WORKSPACE=path         Path to the Arvados source tree to build packages from
 
@@ -47,7 +51,7 @@ if ! [[ -d "$WORKSPACE" ]]; then
 fi
 
 PARSEDOPTS=$(getopt --name "$0" --longoptions \
-    help,debug,test-packages,target:,command:,only-test:,only-build:,build-version: \
+    help,debug,test-packages,target:,command:,only-test:,force-test,only-build:,build-version: \
     -- "" "$@")
 if [ $? -ne 0 ]; then
     exit 1
@@ -72,6 +76,9 @@ while [ $# -gt 0 ]; do
             test_packages=1
             packages="$2"; shift
             ;;
+        --force-test)
+            FORCE_TEST=true
+            ;;
         --only-build)
             ONLY_BUILD="$2"; shift
             ;;
@@ -159,6 +166,7 @@ popd
 
 if test -z "$packages" ; then
     packages="arvados-api-server
+        arvados-client
         arvados-docker-cleaner
         arvados-git-httpd
         arvados-node-manager
@@ -174,14 +182,10 @@ if test -z "$packages" ; then
         keep-rsync
         keepstore
         keep-web
-        libarvados-perl"
-
-    case "$TARGET" in
-        *)
-            packages="$packages python-arvados-fuse
-                  python-arvados-python-client python-arvados-cwl-runner"
-            ;;
-    esac
+        libarvados-perl
+        python-arvados-fuse
+        python-arvados-python-client
+        python-arvados-cwl-runner"
 fi
 
 FINAL_EXITCODE=0
@@ -205,9 +209,19 @@ if [[ -n "$test_packages" ]]; then
         if [[ -n "$ONLY_BUILD" ]] && [[ "$p" != "$ONLY_BUILD" ]]; then
             continue
         fi
+        if [[ -e "${WORKSPACE}/packages/.last_test_${TARGET}" ]] && [[ -z "$FORCE_TEST" ]]; then
+          MATCH=`find ${WORKSPACE}/packages/ -newer ${WORKSPACE}/packages/.last_test_${TARGET} -regex .*${TARGET}/$p.*`
+          if [[ "$MATCH" == "" ]]; then
+            # No new package has been built that needs testing
+            echo "Skipping $p test because no new package was built since the last test."
+            continue
+          fi
+        fi
         echo
         echo "START: $p test on $IMAGE" >&2
-        if docker run --rm \
+        # ulimit option can be removed when debian8 and ubuntu1404 are retired
+        if docker run --ulimit nofile=4096:4096 \
+            --rm \
             "${docker_volume_args[@]}" \
             --env ARVADOS_DEBUG=$ARVADOS_DEBUG \
             --env "TARGET=$TARGET" \
@@ -221,6 +235,8 @@ if [[ -n "$test_packages" ]]; then
             echo "ERROR: $p test on $IMAGE failed with exit status $FINAL_EXITCODE" >&2
         fi
     done
+
+    touch ${WORKSPACE}/packages/.last_test_${TARGET}
 else
     echo
     echo "START: build packages on $IMAGE" >&2
@@ -231,8 +247,9 @@ else
     set +e
     mv -f ${WORKSPACE}/packages/${TARGET}/* ${WORKSPACE}/packages/${TARGET}/processed/ 2>/dev/null
     set -e
-    # Build packages
-    if docker run --rm \
+    # Build packages. ulimit option can be removed when debian8 and ubuntu1404 are retired
+    if docker run --ulimit nofile=4096:4096 \
+        --rm \
         "${docker_volume_args[@]}" \
         --env ARVADOS_BUILDING_VERSION="$ARVADOS_BUILDING_VERSION" \
         --env ARVADOS_BUILDING_ITERATION="$ARVADOS_BUILDING_ITERATION" \