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 If the build is for a Release Candidate this param must be passed
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: \
54 declare -a build_args=()
56 eval set -- "$PARSEDOPTS"
57 while [ $# -gt 0 ]; do
60 echo >&2 "$helpmessage"
74 build_args+=("$1" "$2")
79 echo >&2 "$0: unrecognized argument '$2'. Try: $0 --help"
87 build_args+=(--target "$TARGET")
96 . $WORKSPACE/build/run-library.sh
98 title "Start build packages"
101 $WORKSPACE/build/run-build-packages-one-target.sh "${build_args[@]}"
103 checkexit $? "build packages"
104 title "End of build packages (`timer`)"
106 title "Start test packages"
109 if [ ${#failures[@]} -eq 0 ]; then
110 $WORKSPACE/build/run-build-packages-one-target.sh "${build_args[@]}" --test-packages
112 echo "Skipping package upload, there were errors building the packages"
115 checkexit $? "test packages"
116 title "End of test packages (`timer`)"
118 if [[ "$UPLOAD" != 0 ]]; then
119 title "Start upload packages"
122 if [ ${#failures[@]} -eq 0 ]; then
123 if [[ "$RC" != 0 ]]; then
124 echo "/usr/local/arvados-dev/jenkins/run_upload_packages_testing.py -H jenkinsapt@apt.arvados.org -o Port=2222 --workspace $WORKSPACE $TARGET"
125 /usr/local/arvados-dev/jenkins/run_upload_packages_testing.py -H jenkinsapt@apt.arvados.org -o Port=2222 --workspace $WORKSPACE $TARGET
127 echo "/usr/local/arvados-dev/jenkins/run_upload_packages.py -H jenkinsapt@apt.arvados.org -o Port=2222 --workspace $WORKSPACE $TARGET"
128 /usr/local/arvados-dev/jenkins/run_upload_packages.py -H jenkinsapt@apt.arvados.org -o Port=2222 --workspace $WORKSPACE $TARGET
131 echo "Skipping package upload, there were errors building and/or testing the packages"
133 checkexit $? "upload packages"
134 title "End of upload packages (`timer`)"