3 read -rd "\000" helpmessage <<EOF
4 $(basename $0): Orchestrate run-build-packages.sh for one target
7 WORKSPACE=/path/to/arvados $(basename $0) [options]
10 Distribution to build packages for (default: debian7)
12 Build command to execute (default: use built-in Docker image command)
14 Run package install test script "test-packages-$target.sh"
16 Output debug information (default: false)
18 Test only a specific package
20 WORKSPACE=path Path to the Arvados source tree to build packages from
26 if ! [[ -n "$WORKSPACE" ]]; then
27 echo >&2 "$helpmessage"
29 echo >&2 "Error: WORKSPACE environment variable not set"
34 if ! [[ -d "$WORKSPACE" ]]; then
35 echo >&2 "$helpmessage"
37 echo >&2 "Error: $WORKSPACE is not a directory"
42 PARSEDOPTS=$(getopt --name "$0" --longoptions \
43 help,debug,test-packages,target:,command:,only-test: \
53 eval set -- "$PARSEDOPTS"
54 while [ $# -gt 0 ]; do
57 echo >&2 "$helpmessage"
78 echo >&2 "$0: unrecognized argument '$2'. Try: $0 --help"
88 if [[ -n "$test_packages" ]]; then
89 if [[ -n "$(find $WORKSPACE/packages/$TARGET -name '*.rpm')" ]] ; then
90 createrepo $WORKSPACE/packages/$TARGET
93 if [[ -n "$(find $WORKSPACE/packages/$TARGET -name '*.deb')" ]] ; then
94 (cd $WORKSPACE/packages/$TARGET
95 dpkg-scanpackages . 2> >(grep -v 'warning' 1>&2) | gzip -c > Packages.gz
99 COMMAND="/jenkins/package-testing/test-packages-$TARGET.sh"
100 IMAGE="arvados/package-test:$TARGET"
102 IMAGE="arvados/build:$TARGET"
103 if [[ "$COMMAND" != "" ]]; then
104 COMMAND="/usr/local/rvm/bin/rvm-exec default bash /jenkins/$COMMAND --target $TARGET$DEBUG"
108 JENKINS_DIR=$(dirname "$(readlink -e "$0")")
110 if [[ -n "$test_packages" ]]; then
111 pushd "$JENKINS_DIR/package-test-dockerfiles"
113 pushd "$JENKINS_DIR/package-build-dockerfiles"
114 make "$TARGET/generated"
119 time docker build --tag=$IMAGE .
122 if test -z "$packages" ; then
123 packages="arvados-api-server
125 arvados-docker-cleaner
130 crunch-dispatch-local
131 crunch-dispatch-slurm
144 packages="$packages python27-python-arvados-fuse
145 python27-python-arvados-python-client python27-python-arvados-cwl-runner"
148 packages="$packages python-arvados-fuse
149 python-arvados-python-client python-arvados-cwl-runner"
158 mkdir -p "$WORKSPACE/apps/workbench/vendor/cache-$TARGET"
159 mkdir -p "$WORKSPACE/services/api/vendor/cache-$TARGET"
162 -v "$JENKINS_DIR:/jenkins"
163 -v "$WORKSPACE:/arvados"
164 -v /arvados/services/api/vendor/bundle
165 -v /arvados/apps/workbench/vendor/bundle
166 -v "$WORKSPACE/services/api/vendor/cache-$TARGET:/arvados/services/api/vendor/cache"
167 -v "$WORKSPACE/apps/workbench/vendor/cache-$TARGET:/arvados/apps/workbench/vendor/cache"
170 if [[ -n "$test_packages" ]]; then
171 for p in $packages ; do
173 echo "START: $p test on $IMAGE" >&2
175 "${docker_volume_args[@]}" \
176 --env ARVADOS_DEBUG=1 \
177 --env "TARGET=$TARGET" \
178 --env "WORKSPACE=/arvados" \
181 echo "OK: $p test on $IMAGE succeeded" >&2
184 package_fails="$package_fails $p"
185 echo "ERROR: $p test on $IMAGE failed with exit status $FINAL_EXITCODE" >&2
190 echo "START: build packages on $IMAGE" >&2
192 "${docker_volume_args[@]}" \
193 --env ARVADOS_DEBUG=1 \
197 echo "OK: build packages on $IMAGE succeeded" >&2
200 echo "ERROR: build packages on $IMAGE failed with exit status $FINAL_EXITCODE" >&2
204 if test -n "$package_fails" ; then
205 echo "Failed package tests:$package_fails" >&2