X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/60f3033a6ad0c4d155344b1d4922f3b2e1cb29bc..2af7b0336b2b92e38f6966b8bbc233c05704815d:/build/run-build-docker-jobs-image.sh diff --git a/build/run-build-docker-jobs-image.sh b/build/run-build-docker-jobs-image.sh index 7186a22091..9d7e3777cd 100755 --- a/build/run-build-docker-jobs-image.sh +++ b/build/run-build-docker-jobs-image.sh @@ -5,21 +5,24 @@ function usage { echo >&2 - echo >&2 "usage: $0 [options]" + echo >&2 "usage: WORKSPACE=/path/to/arvados $0 [options]" echo >&2 echo >&2 "$0 options:" echo >&2 " -t, --tags version tag for docker" + echo >&2 " -r, --repo Arvados package repo to use: dev (default), testing, stable" echo >&2 " -u, --upload Upload the images (docker push)" echo >&2 " --no-cache Don't use build cache" echo >&2 " -h, --help Display this help and exit" echo >&2 - echo >&2 " If no options are given, just builds the images." + echo >&2 " WORKSPACE=path Path to the Arvados source tree to build from" + echo >&2 } upload=false +REPO=dev # NOTE: This requires GNU getopt (part of the util-linux package on Debian-based distros). -TEMP=`getopt -o hut: \ - --long help,upload,no-cache,tags: \ +TEMP=`getopt -o hut:r: \ + --long help,upload,no-cache,tags:,repo: \ -n "$0" -- "$@"` if [ $? != 0 ] ; then echo "Use -h for help"; exit 1 ; fi @@ -50,6 +53,19 @@ do ;; esac ;; + -r | --repo) + case "$2" in + "") + echo "ERROR: --repo needs a parameter"; + usage; + exit 1 + ;; + *) + REPO="$2"; + shift 2 + ;; + esac + ;; --) shift break @@ -69,6 +85,16 @@ exit_cleanly() { exit $EXITCODE } +# Sanity check +if ! [[ -n "$WORKSPACE" ]]; then + usage; + echo >&2 "Error: WORKSPACE environment variable not set" + echo >&2 + exit 1 +fi + +echo $WORKSPACE + COLUMNS=80 . $WORKSPACE/build/run-library.sh @@ -88,16 +114,6 @@ docker_push () { checkexit $ECODE "docker push $*" } -# Sanity check -if ! [[ -n "$WORKSPACE" ]]; then - echo >&2 - echo >&2 "Error: WORKSPACE environment variable not set" - echo >&2 - exit 1 -fi - -echo $WORKSPACE - # find the docker binary DOCKER=`which docker.io` @@ -123,15 +139,7 @@ if [[ -z "$ARVADOS_BUILDING_VERSION" ]] && ! [[ -z "$version_tag" ]]; then ARVADOS_BUILDING_ITERATION="1" fi -python_sdk_ts=$(cd sdk/python && timestamp_from_git) -cwl_runner_ts=$(cd sdk/cwl && timestamp_from_git) - -python_sdk_version=$(cd sdk/python && nohash_version_from_git 0.1) -cwl_runner_version=$(cd sdk/cwl && nohash_version_from_git 1.0) - -if [[ $python_sdk_ts -gt $cwl_runner_ts ]]; then - cwl_runner_version=$(cd sdk/python && nohash_version_from_git 1.0) -fi +calculate_python_sdk_cwl_package_versions echo cwl_runner_version $cwl_runner_version python_sdk_version $python_sdk_version @@ -141,7 +149,12 @@ else python_sdk_version="${ARVADOS_BUILDING_VERSION}-${ARVADOS_BUILDING_ITERATION}" fi -cwl_runner_version_orig=$cwl_runner_version +# What we use to tag the Docker image. For release candidate +# packages, the OS package has a "~rc" suffix, but Python requires +# just an "rc" suffix. Arvados-cwl-runner will be expecting the +# Python-compatible version string when it tries to pull the Docker +# image, but --build-arg is expecting the OS package version. +cwl_runner_version_tag=$(echo -n $cwl_runner_version | sed s/~rc/rc/g) if [[ "${cwl_runner_version}" != "${ARVADOS_BUILDING_VERSION}" ]]; then cwl_runner_version="${cwl_runner_version}-1" @@ -153,7 +166,8 @@ cd docker/jobs docker build $NOCACHE \ --build-arg python_sdk_version=${python_sdk_version} \ --build-arg cwl_runner_version=${cwl_runner_version} \ - -t arvados/jobs:$cwl_runner_version_orig . + --build-arg repo_version=${REPO} \ + -t arvados/jobs:$cwl_runner_version_tag . ECODE=$? @@ -175,26 +189,24 @@ if docker --version |grep " 1\.[0-9]\." ; then # -f flag removed in Docker 1.12 FORCE=-f fi + if ! [[ -z "$version_tag" ]]; then - docker tag $FORCE arvados/jobs:$cwl_runner_version_orig arvados/jobs:"$version_tag" -else - docker tag $FORCE arvados/jobs:$cwl_runner_version_orig arvados/jobs:latest -fi + docker tag $FORCE arvados/jobs:$cwl_runner_version_tag arvados/jobs:"$version_tag" + ECODE=$? -ECODE=$? + if [[ "$ECODE" != "0" ]]; then + EXITCODE=$(($EXITCODE + $ECODE)) + fi -if [[ "$ECODE" != "0" ]]; then - EXITCODE=$(($EXITCODE + $ECODE)) + checkexit $ECODE "docker tag" + title "docker tag complete (`timer`)" fi -checkexit $ECODE "docker tag" -title "docker tag complete (`timer`)" - title "uploading images" timer_reset -if [[ "$ECODE" != "0" ]]; then +if [[ "$EXITCODE" != "0" ]]; then title "upload arvados images SKIPPED because build or tag failed" else if [[ $upload == true ]]; then @@ -204,8 +216,7 @@ else if ! [[ -z "$version_tag" ]]; then docker_push arvados/jobs:"$version_tag" else - docker_push arvados/jobs:$cwl_runner_version_orig - docker_push arvados/jobs:latest + docker_push arvados/jobs:$cwl_runner_version_tag fi title "upload arvados images finished (`timer`)" else