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 if [[ -n "$test_packages" ]]; then
154 for p in $packages ; do
155 if docker run --rm -v "$JENKINS_DIR:/jenkins" -v "$WORKSPACE:/arvados" \
156 --env ARVADOS_DEBUG=1 \
157 --env "TARGET=$TARGET" \
158 --env "WORKSPACE=/arvados" \
159 "$IMAGE" $COMMAND $p ; then
163 package_fails="$package_fails $p"
164 echo "ERROR: $tag test failed with exit status $FINAL_EXITCODE." >&2
168 if docker run --rm -v "$JENKINS_DIR:/jenkins" -v "$WORKSPACE:/arvados" \
169 --env ARVADOS_DEBUG=1 "$IMAGE" $COMMAND ; then
171 echo "Build packages for $TARGET succeeded." >&2
174 echo "ERROR: $tag build failed with exit status $FINAL_EXITCODE." >&2
178 if test -n "$package_fails" ; then
179 echo "Failed package tests:$package_fails" >&2