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: debian10)
15 If the build and test steps are successful, upload the packages
16 to a remote apt repository (default: false)
18 Output debug information (default: false)
20 Optional Parameter to build Release Candidate
21 --build-version <version>
22 Version to build (default:
23 \$ARVADOS_BUILDING_VERSION-\$ARVADOS_BUILDING_ITERATION or
24 0.1.timestamp.commithash)
26 WORKSPACE=path Path to the Arvados source tree to build packages from
30 if ! [[ -n "$WORKSPACE" ]]; then
31 echo >&2 "$helpmessage"
33 echo >&2 "Error: WORKSPACE environment variable not set"
38 if ! [[ -d "$WORKSPACE" ]]; then
39 echo >&2 "$helpmessage"
41 echo >&2 "Error: $WORKSPACE is not a directory"
46 PARSEDOPTS=$(getopt --name "$0" --longoptions \
47 help,debug,upload,rc,target:,build-version: \
58 declare -a build_args=()
60 eval set -- "$PARSEDOPTS"
61 while [ $# -gt 0 ]; do
64 echo >&2 "$helpmessage"
81 build_args+=("$1" "$2")
86 echo >&2 "$0: unrecognized argument '$2'. Try: $0 --help"
94 build_args+=(--target "$TARGET")
103 . $WORKSPACE/build/run-library.sh
105 title "Start build packages"
108 $WORKSPACE/build/run-build-packages-one-target.sh "${build_args[@]}"$DEBUG
110 checkexit $? "build packages"
111 title "End of build packages (`timer`)"
113 title "Start test packages"
116 if [ ${#failures[@]} -eq 0 ]; then
117 $WORKSPACE/build/run-build-packages-one-target.sh "${build_args[@]}" --test-packages$DEBUG
119 echo "Skipping package upload, there were errors building the packages"
122 checkexit $? "test packages"
123 title "End of test packages (`timer`)"
125 if [[ "$UPLOAD" != 0 ]]; then
126 title "Start upload packages"
129 if [ ${#failures[@]} -eq 0 ]; then
130 if [[ "$RC" != 0 ]]; then
131 echo "/usr/local/arvados-dev/jenkins/run_upload_packages_testing.py -H jenkinsapt@apt.arvados.org -o Port=2222 --workspace $WORKSPACE $TARGET"
132 /usr/local/arvados-dev/jenkins/run_upload_packages_testing.py -H jenkinsapt@apt.arvados.org -o Port=2222 --workspace $WORKSPACE $TARGET
134 echo "/usr/local/arvados-dev/jenkins/run_upload_packages.py -H jenkinsapt@apt.arvados.org -o Port=2222 --workspace $WORKSPACE $TARGET"
135 /usr/local/arvados-dev/jenkins/run_upload_packages.py -H jenkinsapt@apt.arvados.org -o Port=2222 --workspace $WORKSPACE $TARGET
138 echo "Skipping package upload, there were errors building and/or testing the packages"
140 checkexit $? "upload packages"
141 title "End of upload packages (`timer`)"