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
24 if ! [[ -n "$WORKSPACE" ]]; then
25 echo >&2 "$helpmessage"
27 echo >&2 "Error: WORKSPACE environment variable not set"
32 if ! [[ -d "$WORKSPACE" ]]; then
33 echo >&2 "$helpmessage"
35 echo >&2 "Error: $WORKSPACE is not a directory"
40 PARSEDOPTS=$(getopt --name "$0" --longoptions \
41 help,debug,test-packages,target:,command:,only-test: \
51 eval set -- "$PARSEDOPTS"
52 while [ $# -gt 0 ]; do
55 echo >&2 "$helpmessage"
76 echo >&2 "$0: unrecognized argument '$2'. Try: $0 --help"
86 if [[ -n "$test_packages" ]]; then
87 if [[ -n "$(find $WORKSPACE/packages/$TARGET -name *.rpm)" ]] ; then
88 createrepo $WORKSPACE/packages/$TARGET
91 if [[ -n "$(find $WORKSPACE/packages/$TARGET -name *.deb)" ]] ; then
92 (cd $WORKSPACE/packages/$TARGET
93 dpkg-scanpackages . 2> >(grep -v 'warning' 1>&2) | gzip -c > Packages.gz
97 COMMAND="/jenkins/test-packages-$TARGET.sh"
98 IMAGE="arvados/package-test:$TARGET"
100 IMAGE="arvados/build:$TARGET"
101 if [[ "$COMMAND" != "" ]]; then
102 COMMAND="/usr/local/rvm/bin/rvm-exec default bash /jenkins/$COMMAND --target $TARGET$DEBUG"
106 JENKINS_DIR=$(dirname "$(readlink -e "$0")")
108 if [[ -n "$test_packages" ]]; then
109 pushd "$JENKINS_DIR/package-test-dockerfiles"
111 pushd "$JENKINS_DIR/dockerfiles"
116 time docker build --tag=$IMAGE .
119 if test -z "$packages" ; then
120 packages="arvados-api-server
122 arvados-docker-cleaner
134 if test $target == centos6 ; then
135 packages="$packages python27-python-arvados-fuse
136 python27-python-arvados-python-client"
138 packages="$packages python-arvados-fuse
139 python-arvados-python-client"
147 if [[ -n "$test_packages" ]]; then
148 for p in $packages ; do
149 if ! docker run --rm -v "$JENKINS_DIR:/jenkins" -v "$WORKSPACE:/arvados" \
150 --env ARVADOS_DEBUG=1 "$IMAGE" $COMMAND $p ; then
152 package_fails="$package_fails $p"
153 echo "ERROR: $tag build failed with exit status $FINAL_EXITCODE." >&2
157 if docker run --rm -v "$JENKINS_DIR:/jenkins" -v "$WORKSPACE:/arvados" \
158 --env ARVADOS_DEBUG=1 "$IMAGE" $COMMAND; then
159 # Success - nothing more to do.
163 echo "ERROR: $tag build failed with exit status $FINAL_EXITCODE." >&2
167 if test -n "$package_fails" ; then
168 echo "Failed package tests:$package_fails"