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
85 echo >&2 "$0: unrecognized argument '$2'. Try: $0 --help"
95 if [[ -n "$test_packages" ]]; then
96 if [[ -n "$(find $WORKSPACE/packages/$TARGET -name '*.rpm')" ]] ; then
97 createrepo $WORKSPACE/packages/$TARGET
100 if [[ -n "$(find $WORKSPACE/packages/$TARGET -name '*.deb')" ]] ; then
101 (cd $WORKSPACE/packages/$TARGET
102 dpkg-scanpackages . 2> >(grep -v 'warning' 1>&2) | tee Packages | gzip -c > Packages.gz
103 apt-ftparchive -o APT::FTPArchive::Release::Origin=Arvados release . > Release
107 COMMAND="/jenkins/package-testing/test-packages-$TARGET.sh"
108 IMAGE="arvados/package-test:$TARGET"
110 IMAGE="arvados/build:$TARGET"
111 if [[ "$COMMAND" != "" ]]; then
112 COMMAND="/usr/local/rvm/bin/rvm-exec default bash /jenkins/$COMMAND --target $TARGET$DEBUG"
116 JENKINS_DIR=$(dirname "$(readlink -e "$0")")
118 if [[ -n "$test_packages" ]]; then
119 pushd "$JENKINS_DIR/package-test-dockerfiles"
121 pushd "$JENKINS_DIR/package-build-dockerfiles"
122 make "$TARGET/generated"
127 time docker build --tag=$IMAGE .
130 if test -z "$packages" ; then
131 packages="arvados-api-server
132 arvados-docker-cleaner
137 crunch-dispatch-local
138 crunch-dispatch-slurm
151 packages="$packages python-arvados-fuse
152 python-arvados-python-client python-arvados-cwl-runner"
161 mkdir -p "$WORKSPACE/apps/workbench/vendor/cache-$TARGET"
162 mkdir -p "$WORKSPACE/services/api/vendor/cache-$TARGET"
165 -v "$JENKINS_DIR:/jenkins"
166 -v "$WORKSPACE:/arvados"
167 -v /arvados/services/api/vendor/bundle
168 -v /arvados/apps/workbench/vendor/bundle
169 -v "$WORKSPACE/services/api/vendor/cache-$TARGET:/arvados/services/api/vendor/cache"
170 -v "$WORKSPACE/apps/workbench/vendor/cache-$TARGET:/arvados/apps/workbench/vendor/cache"
173 if [[ -n "$test_packages" ]]; then
174 for p in $packages ; do
175 if [[ -n "$ONLY_BUILD" ]] && [[ "$p" != "$ONLY_BUILD" ]]; then
179 echo "START: $p test on $IMAGE" >&2
181 "${docker_volume_args[@]}" \
182 --env ARVADOS_DEBUG=$ARVADOS_DEBUG \
183 --env "TARGET=$TARGET" \
184 --env "WORKSPACE=/arvados" \
187 echo "OK: $p test on $IMAGE succeeded" >&2
190 package_fails="$package_fails $p"
191 echo "ERROR: $p test on $IMAGE failed with exit status $FINAL_EXITCODE" >&2
196 echo "START: build packages on $IMAGE" >&2
198 "${docker_volume_args[@]}" \
199 --env ARVADOS_DEBUG=$ARVADOS_DEBUG \
200 --env "ONLY_BUILD=$ONLY_BUILD" \
204 echo "OK: build packages on $IMAGE succeeded" >&2
207 echo "ERROR: build packages on $IMAGE failed with exit status $FINAL_EXITCODE" >&2
211 if test -n "$package_fails" ; then
212 echo "Failed package tests:$package_fails" >&2