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: debian8)
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)
17 --only-build <package>
18 Build only a specific package
20 Test only a specific package
22 WORKSPACE=path Path to the Arvados source tree to build packages from
28 if ! [[ -n "$WORKSPACE" ]]; then
29 echo >&2 "$helpmessage"
31 echo >&2 "Error: WORKSPACE environment variable not set"
36 if ! [[ -d "$WORKSPACE" ]]; then
37 echo >&2 "$helpmessage"
39 echo >&2 "Error: $WORKSPACE is not a directory"
44 PARSEDOPTS=$(getopt --name "$0" --longoptions \
45 help,debug,test-packages,target:,command:,only-test:,only-build: \
55 eval set -- "$PARSEDOPTS"
56 while [ $# -gt 0 ]; do
59 echo >&2 "$helpmessage"
71 ONLY_BUILD="$2"; shift
84 echo >&2 "$0: unrecognized argument '$2'. Try: $0 --help"
94 if [[ -n "$test_packages" ]]; then
95 if [[ -n "$(find $WORKSPACE/packages/$TARGET -name '*.rpm')" ]] ; then
96 createrepo $WORKSPACE/packages/$TARGET
99 if [[ -n "$(find $WORKSPACE/packages/$TARGET -name '*.deb')" ]] ; then
100 (cd $WORKSPACE/packages/$TARGET
101 dpkg-scanpackages . 2> >(grep -v 'warning' 1>&2) | gzip -c > Packages.gz
105 COMMAND="/jenkins/package-testing/test-packages-$TARGET.sh"
106 IMAGE="arvados/package-test:$TARGET"
108 IMAGE="arvados/build:$TARGET"
109 if [[ "$COMMAND" != "" ]]; then
110 COMMAND="/usr/local/rvm/bin/rvm-exec default bash /jenkins/$COMMAND --target $TARGET$DEBUG"
114 JENKINS_DIR=$(dirname "$(readlink -e "$0")")
116 if [[ -n "$test_packages" ]]; then
117 pushd "$JENKINS_DIR/package-test-dockerfiles"
119 pushd "$JENKINS_DIR/package-build-dockerfiles"
120 make "$TARGET/generated"
125 time docker build --tag=$IMAGE .
128 if test -z "$packages" ; then
129 packages="arvados-api-server
130 arvados-docker-cleaner
135 crunch-dispatch-local
136 crunch-dispatch-slurm
149 packages="$packages python-arvados-fuse
150 python-arvados-python-client python-arvados-cwl-runner"
159 mkdir -p "$WORKSPACE/apps/workbench/vendor/cache-$TARGET"
160 mkdir -p "$WORKSPACE/services/api/vendor/cache-$TARGET"
163 -v "$JENKINS_DIR:/jenkins"
164 -v "$WORKSPACE:/arvados"
165 -v /arvados/services/api/vendor/bundle
166 -v /arvados/apps/workbench/vendor/bundle
167 -v "$WORKSPACE/services/api/vendor/cache-$TARGET:/arvados/services/api/vendor/cache"
168 -v "$WORKSPACE/apps/workbench/vendor/cache-$TARGET:/arvados/apps/workbench/vendor/cache"
171 if [[ -n "$test_packages" ]]; then
172 for p in $packages ; do
173 if [[ -n "$ONLY_BUILD" ]] && [[ "$p" != "$ONLY_BUILD" ]]; then
177 echo "START: $p test on $IMAGE" >&2
179 "${docker_volume_args[@]}" \
180 --env ARVADOS_DEBUG=1 \
181 --env "TARGET=$TARGET" \
182 --env "WORKSPACE=/arvados" \
185 echo "OK: $p test on $IMAGE succeeded" >&2
188 package_fails="$package_fails $p"
189 echo "ERROR: $p test on $IMAGE failed with exit status $FINAL_EXITCODE" >&2
194 echo "START: build packages on $IMAGE" >&2
196 "${docker_volume_args[@]}" \
197 --env ARVADOS_DEBUG=1 \
198 --env "ONLY_BUILD=$ONLY_BUILD" \
202 echo "OK: build packages on $IMAGE succeeded" >&2
205 echo "ERROR: build packages on $IMAGE failed with exit status $FINAL_EXITCODE" >&2
209 if test -n "$package_fails" ; then
210 echo "Failed package tests:$package_fails" >&2