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
139 packages="$packages python27-python-arvados-fuse
140 python27-python-arvados-python-client"
143 packages="$packages python-arvados-fuse
144 python-arvados-python-client"
153 mkdir -p "$WORKSPACE/apps/workbench/vendor/cache-$TARGET"
154 mkdir -p "$WORKSPACE/services/api/vendor/cache-$TARGET"
157 -v "$JENKINS_DIR:/jenkins"
158 -v "$WORKSPACE:/arvados"
159 -v /arvados/services/api/vendor/bundle
160 -v /arvados/apps/workbench/vendor/bundle
161 -v "$WORKSPACE/services/api/vendor/cache-$TARGET:/arvados/services/api/vendor/cache"
162 -v "$WORKSPACE/apps/workbench/vendor/cache-$TARGET:/arvados/apps/workbench/vendor/cache"
165 if [[ -n "$test_packages" ]]; then
166 for p in $packages ; do
168 "${docker_volume_args[@]}" \
169 --env ARVADOS_DEBUG=1 \
170 --env "TARGET=$TARGET" \
171 --env "WORKSPACE=/arvados" \
177 package_fails="$package_fails $p"
178 echo "ERROR: $tag test failed with exit status $FINAL_EXITCODE." >&2
183 "${docker_volume_args[@]}" \
184 --env ARVADOS_DEBUG=1 \
188 echo "Build packages for $TARGET succeeded." >&2
191 echo "ERROR: $tag build failed with exit status $FINAL_EXITCODE." >&2
195 if test -n "$package_fails" ; then
196 echo "Failed package tests:$package_fails" >&2