Prathmesh Prabhu | 4220754 | 2020-04-20 23:13:23 -0700 | [diff] [blame] | 1 | # Copyright 2020 The Chromium OS Authors. All rights reserved. |
| 2 | # Use of this source code is governed by a BSD-style license that can be |
| 3 | # found in the LICENSE file. |
| 4 | # |
| 5 | # Sets up cipd packages for presubmit scripts. |
| 6 | # |
| 7 | # Scripts should set the script_dir variable and source this file: |
| 8 | # |
| 9 | # readonly script_dir="$(dirname "$(realpath -e "${BASH_SOURCE[0]}")")" |
| 10 | # source "${script_dir}/setup_cipd.sh" |
David Burger | 7f5a8fb | 2020-06-01 10:17:32 -0600 | [diff] [blame] | 11 | # |
| 12 | # Upon completion of this script the $PATH has been adjusted and other |
| 13 | # environment variables, such as $CIPD_ROOT, also exist for finer grained |
| 14 | # control. |
Prathmesh Prabhu | 4220754 | 2020-04-20 23:13:23 -0700 | [diff] [blame] | 15 | |
Andrew Lamb | 3501307 | 2020-05-04 11:05:48 -0600 | [diff] [blame] | 16 | if [[ -z "${script_dir}" ]]; then |
| 17 | echo "The script_dir variable must be set when setup_cipd.sh is called." |
| 18 | exit 1 |
| 19 | fi |
| 20 | |
Prathmesh Prabhu | 4220754 | 2020-04-20 23:13:23 -0700 | [diff] [blame] | 21 | # Versions of packages to get from CIPD. |
| 22 | readonly CIPD_PROTOC_VERSION='v3.6.1' |
| 23 | readonly CIPD_PROTOC_GEN_GO_VERSION='v1.3.2' |
Sean McAllister | 1144d54 | 2021-07-28 08:09:59 -0600 | [diff] [blame] | 24 | readonly CIPD_BUF_VERSION='0.46.0' |
Prathmesh Prabhu | 4220754 | 2020-04-20 23:13:23 -0700 | [diff] [blame] | 25 | |
David Burger | 7f5a8fb | 2020-06-01 10:17:32 -0600 | [diff] [blame] | 26 | readonly CIPD_ROOT="${script_dir}/.cipd_bin" |
Prathmesh Prabhu | 4220754 | 2020-04-20 23:13:23 -0700 | [diff] [blame] | 27 | cipd ensure \ |
| 28 | -log-level warning \ |
David Burger | 7f5a8fb | 2020-06-01 10:17:32 -0600 | [diff] [blame] | 29 | -root "${CIPD_ROOT}" \ |
Prathmesh Prabhu | 4220754 | 2020-04-20 23:13:23 -0700 | [diff] [blame] | 30 | -ensure-file - \ |
| 31 | <<ENSURE_FILE |
Sean McAllister | 8704ebd | 2021-06-23 13:38:27 -0600 | [diff] [blame] | 32 | fuchsia/third_party/jq/\${platform} latest |
Prathmesh Prabhu | 4220754 | 2020-04-20 23:13:23 -0700 | [diff] [blame] | 33 | infra/tools/protoc/\${platform} protobuf_version:${CIPD_PROTOC_VERSION} |
| 34 | chromiumos/infra/tools/protoc-gen-go version:${CIPD_PROTOC_GEN_GO_VERSION} |
| 35 | infra/3pp/tools/go/\${platform} latest |
Sean McAllister | 1144d54 | 2021-07-28 08:09:59 -0600 | [diff] [blame] | 36 | infra/3pp/go/github.com/bufbuild/buf/\${platform} version:2@${CIPD_BUF_VERSION} |
Prathmesh Prabhu | 4220754 | 2020-04-20 23:13:23 -0700 | [diff] [blame] | 37 | ENSURE_FILE |
David Burger | 94ed6db | 2020-07-20 11:57:44 -0600 | [diff] [blame] | 38 | PATH="${CIPD_ROOT}/bin:${CIPD_ROOT}:${PATH}" |