X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/dd8e2deab16cfdf261c45e139be38b756f8bb324..159bbdc44f02a590db6ac5cbe13240b273b6ebd3:/build/run-build-packages-one-target.sh diff --git a/build/run-build-packages-one-target.sh b/build/run-build-packages-one-target.sh index c675a2407c..9b21b58e2a 100755 --- a/build/run-build-packages-one-target.sh +++ b/build/run-build-packages-one-target.sh @@ -21,6 +21,8 @@ Syntax: Build only a specific package --only-test Test only a specific package +--force-test + Test even if there is no new untested package --build-version Version to build (default: \$ARVADOS_BUILDING_VERSION-\$ARVADOS_BUILDING_ITERATION or @@ -49,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,8 +74,12 @@ while [ $# -gt 0 ]; do ;; --only-test) test_packages=1 + testing_one_package=1 packages="$2"; shift ;; + --force-test) + FORCE_TEST=true + ;; --only-build) ONLY_BUILD="$2"; shift ;; @@ -116,39 +122,40 @@ if [[ -n "$ARVADOS_BUILDING_VERSION" ]]; then fi if [[ -n "$test_packages" ]]; then - if [[ -n "$(find $WORKSPACE/packages/$TARGET -name '*.rpm')" ]] ; then - set +e - /usr/bin/which createrepo >/dev/null - if [[ "$?" != "0" ]]; then - echo >&2 - echo >&2 "Error: please install createrepo. E.g. sudo apt-get install createrepo" - echo >&2 - exit 1 - fi - set -e - createrepo $WORKSPACE/packages/$TARGET + if [[ -n "$(find $WORKSPACE/packages/$TARGET -name '*.rpm')" ]] ; then + set +e + /usr/bin/which createrepo >/dev/null + if [[ "$?" != "0" ]]; then + echo >&2 + echo >&2 "Error: please install createrepo. E.g. sudo apt-get install createrepo" + echo >&2 + exit 1 fi + set -e + createrepo $WORKSPACE/packages/$TARGET + fi - if [[ -n "$(find $WORKSPACE/packages/$TARGET -name '*.deb')" ]] ; then - (cd $WORKSPACE/packages/$TARGET - dpkg-scanpackages . 2> >(grep -v 'warning' 1>&2) | tee Packages | gzip -c > Packages.gz - apt-ftparchive -o APT::FTPArchive::Release::Origin=Arvados release . > Release - ) - fi + if [[ -n "$(find $WORKSPACE/packages/$TARGET -name '*.deb')" ]] ; then + (cd $WORKSPACE/packages/$TARGET + dpkg-scanpackages . 2> >(grep -v 'warning' 1>&2) | tee Packages | gzip -c > Packages.gz + apt-ftparchive -o APT::FTPArchive::Release::Origin=Arvados release . > Release + ) + fi - COMMAND="/jenkins/package-testing/test-packages-$TARGET.sh" - IMAGE="arvados/package-test:$TARGET" + COMMAND="/jenkins/package-testing/test-packages-$TARGET.sh" + IMAGE="arvados/package-test:$TARGET" else - IMAGE="arvados/build:$TARGET" - if [[ "$COMMAND" != "" ]]; then - COMMAND="/usr/local/rvm/bin/rvm-exec default bash /jenkins/$COMMAND --target $TARGET$DEBUG" - fi + IMAGE="arvados/build:$TARGET" + if [[ "$COMMAND" != "" ]]; then + COMMAND="/usr/local/rvm/bin/rvm-exec default bash /jenkins/$COMMAND --target $TARGET$DEBUG" + fi fi JENKINS_DIR=$(dirname "$(readlink -e "$0")") if [[ -n "$test_packages" ]]; then pushd "$JENKINS_DIR/package-test-dockerfiles" + make "$TARGET/generated" else pushd "$JENKINS_DIR/package-build-dockerfiles" make "$TARGET/generated" @@ -161,6 +168,7 @@ popd if test -z "$packages" ; then packages="arvados-api-server + arvados-client arvados-docker-cleaner arvados-git-httpd arvados-node-manager @@ -176,14 +184,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 @@ -207,9 +211,30 @@ 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 + # If we're testing all packages, we should not error out on packages that don't exist. + # If we are testing one specific package only (i.e. --only-test was given), we should + # error out if that package does not exist. + if [[ -z "$testing_one_package" ]]; then + MATCH=`find ${WORKSPACE}/packages/ -regextype posix-extended -regex .*${TARGET}/$p.*\\(deb\\|rpm\\)` + if [[ "$MATCH" == "" ]]; then + # No new package has been built that needs testing + echo "Skipping $p test because no package file is available to 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" \ @@ -223,6 +248,10 @@ if [[ -n "$test_packages" ]]; then echo "ERROR: $p test on $IMAGE failed with exit status $FINAL_EXITCODE" >&2 fi done + + if [[ "$FINAL_EXITCODE" == "0" ]]; then + touch ${WORKSPACE}/packages/.last_test_${TARGET} + fi else echo echo "START: build packages on $IMAGE" >&2 @@ -233,8 +262,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" \