2 # Copyright (C) The Arvados Authors. All rights reserved.
4 # SPDX-License-Identifier: AGPL-3.0
6 read -rd "\000" helpmessage <<EOF
7 Build an arvados/jobs Docker image from local git tree.
9 Intended for use by developers working on arvados-python-client or
10 arvados-cwl-runner and need to run a crunch job with a custom package
11 version. Also supports building custom cwltool if CWLTOOL is set.
14 WORKSPACE=/path/to/arvados $(basename $0)
16 WORKSPACE=path Path to the Arvados source tree to build packages from
17 CWLTOOL=path (optional) Path to cwltool git repository.
18 SALAD=path (optional) Path to schema_salad git repository.
19 PYCMD=pythonexec (optional) Specify the python executable to use in the docker image. Defaults to "python".
25 if [[ -z "$WORKSPACE" ]] ; then
26 export WORKSPACE=$(readlink -f $(dirname $0)/..)
27 echo "Using WORKSPACE $WORKSPACE"
30 if [[ -z "$ARVADOS_API_HOST" || -z "$ARVADOS_API_TOKEN" ]] ; then
33 echo "Must set ARVADOS_API_HOST and ARVADOS_API_TOKEN"
40 if [[ -n "$PYCMD" ]] ; then
44 (cd sdk/python && python setup.py sdist)
45 sdk=$(cd sdk/python/dist && ls -t arvados-python-client-*.tar.gz | head -n1)
47 (cd sdk/cwl && python setup.py sdist)
48 runner=$(cd sdk/cwl/dist && ls -t arvados-cwl-runner-*.tar.gz | head -n1)
50 rm -rf sdk/cwl/salad_dist
51 mkdir -p sdk/cwl/salad_dist
52 if [[ -n "$SALAD" ]] ; then
53 (cd "$SALAD" && python setup.py sdist)
54 salad=$(cd "$SALAD/dist" && ls -t schema-salad-*.tar.gz | head -n1)
55 cp "$SALAD/dist/$salad" $WORKSPACE/sdk/cwl/salad_dist
58 rm -rf sdk/cwl/cwltool_dist
59 mkdir -p sdk/cwl/cwltool_dist
60 if [[ -n "$CWLTOOL" ]] ; then
61 (cd "$CWLTOOL" && python setup.py sdist)
62 cwltool=$(cd "$CWLTOOL/dist" && ls -t cwltool-*.tar.gz | head -n1)
63 cp "$CWLTOOL/dist/$cwltool" $WORKSPACE/sdk/cwl/cwltool_dist
66 . build/run-library.sh
68 python_sdk_ts=$(cd sdk/python && timestamp_from_git)
69 cwl_runner_ts=$(cd sdk/cwl && timestamp_from_git)
71 python_sdk_version=$(cd sdk/python && nohash_version_from_git 0.1)
72 cwl_runner_version=$(cd sdk/cwl && nohash_version_from_git 1.0)
74 if [[ $python_sdk_ts -gt $cwl_runner_ts ]]; then
75 cwl_runner_version=$(cd sdk/python && nohash_version_from_git 1.0)
78 docker build --build-arg sdk=$sdk --build-arg runner=$runner --build-arg salad=$salad --build-arg cwltool=$cwltool --build-arg pythoncmd=$py -f "$WORKSPACE/sdk/dev-jobs.dockerfile" -t arvados/jobs:$cwl_runner_version "$WORKSPACE/sdk"
79 echo arv-keepdocker arvados/jobs $cwl_runner_version
80 arv-keepdocker arvados/jobs $cwl_runner_version