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
140 packages="$packages python27-python-arvados-fuse
141 python27-python-arvados-python-client python27-python-arvados-cwl-runner"
144 packages="$packages python-arvados-fuse
145 python-arvados-python-client python-arvados-cwl-runner"
154 mkdir -p "$WORKSPACE/apps/workbench/vendor/cache-$TARGET"
155 mkdir -p "$WORKSPACE/services/api/vendor/cache-$TARGET"
158 -v "$JENKINS_DIR:/jenkins"
159 -v "$WORKSPACE:/arvados"
160 -v /arvados/services/api/vendor/bundle
161 -v /arvados/apps/workbench/vendor/bundle
162 -v "$WORKSPACE/services/api/vendor/cache-$TARGET:/arvados/services/api/vendor/cache"
163 -v "$WORKSPACE/apps/workbench/vendor/cache-$TARGET:/arvados/apps/workbench/vendor/cache"
166 if [[ -n "$test_packages" ]]; then
167 for p in $packages ; do
169 echo "START: $p test on $IMAGE" >&2
171 "${docker_volume_args[@]}" \
172 --env ARVADOS_DEBUG=1 \
173 --env "TARGET=$TARGET" \
174 --env "WORKSPACE=/arvados" \
177 echo "OK: $p test on $IMAGE succeeded" >&2
180 package_fails="$package_fails $p"
181 echo "ERROR: $p test on $IMAGE failed with exit status $FINAL_EXITCODE" >&2
186 echo "START: build packages on $IMAGE" >&2
188 "${docker_volume_args[@]}" \
189 --env ARVADOS_DEBUG=1 \
193 echo "OK: build packages on $IMAGE succeeded" >&2
196 echo "ERROR: build packages on $IMAGE failed with exit status $FINAL_EXITCODE" >&2
200 if test -n "$package_fails" ; then
201 echo "Failed package tests:$package_fails" >&2