2 # Copyright (C) The Arvados Authors. All rights reserved.
4 # SPDX-License-Identifier: AGPL-3.0
6 read -rd "\000" helpmessage <<EOF
7 $(basename $0): Build, test and (optionally) upload packages for one target
10 WORKSPACE=/path/to/arvados $(basename $0) [options]
13 Distribution to build packages for (default: debian8)
15 If the build and test steps are successful, upload the packages
16 to a remote apt repository (default: false)
18 Optional Parameter to build Release Candidate
19 --build-version <version>
20 Version to build (default:
21 \$ARVADOS_BUILDING_VERSION-\$ARVADOS_BUILDING_ITERATION or
22 0.1.timestamp.commithash)
24 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,upload,rc,target:,build-version: \
55 declare -a build_args=()
57 eval set -- "$PARSEDOPTS"
58 while [ $# -gt 0 ]; do
61 echo >&2 "$helpmessage"
75 build_args+=("$1" "$2")
80 echo >&2 "$0: unrecognized argument '$2'. Try: $0 --help"
88 build_args+=(--target "$TARGET")
97 . $WORKSPACE/build/run-library.sh
99 title "Start build packages"
102 $WORKSPACE/build/run-build-packages-one-target.sh "${build_args[@]}"
104 checkexit $? "build packages"
105 title "End of build packages (`timer`)"
107 title "Start test packages"
110 if [ ${#failures[@]} -eq 0 ]; then
111 $WORKSPACE/build/run-build-packages-one-target.sh "${build_args[@]}" --test-packages
113 echo "Skipping package upload, there were errors building the packages"
116 checkexit $? "test packages"
117 title "End of test packages (`timer`)"
119 if [[ "$UPLOAD" != 0 ]]; then
120 title "Start upload packages"
123 if [ ${#failures[@]} -eq 0 ]; then
124 if [[ "$RC" != 0 ]]; then
125 echo "/usr/local/arvados-dev/jenkins/run_upload_packages_testing.py -H jenkinsapt@apt.arvados.org -o Port=2222 --workspace $WORKSPACE $TARGET"
126 /usr/local/arvados-dev/jenkins/run_upload_packages_testing.py -H jenkinsapt@apt.arvados.org -o Port=2222 --workspace $WORKSPACE $TARGET
128 echo "/usr/local/arvados-dev/jenkins/run_upload_packages.py -H jenkinsapt@apt.arvados.org -o Port=2222 --workspace $WORKSPACE $TARGET"
129 /usr/local/arvados-dev/jenkins/run_upload_packages.py -H jenkinsapt@apt.arvados.org -o Port=2222 --workspace $WORKSPACE $TARGET
132 echo "Skipping package upload, there were errors building and/or testing the packages"
134 checkexit $? "upload packages"
135 title "End of upload packages (`timer`)"