blob: 1941c850c956834a50398f58b4460fd1159e1e29 [file] [log] [blame]
Prathmesh Prabhu42207542020-04-20 23:13:23 -07001# 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 Burger7f5a8fb2020-06-01 10:17:32 -060011#
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 Prabhu42207542020-04-20 23:13:23 -070015
Andrew Lamb35013072020-05-04 11:05:48 -060016if [[ -z "${script_dir}" ]]; then
17 echo "The script_dir variable must be set when setup_cipd.sh is called."
18 exit 1
19fi
20
Prathmesh Prabhu42207542020-04-20 23:13:23 -070021# Versions of packages to get from CIPD.
22readonly CIPD_PROTOC_VERSION='v3.6.1'
23readonly CIPD_PROTOC_GEN_GO_VERSION='v1.3.2'
Sean McAllister1144d542021-07-28 08:09:59 -060024readonly CIPD_BUF_VERSION='0.46.0'
Prathmesh Prabhu42207542020-04-20 23:13:23 -070025
David Burger7f5a8fb2020-06-01 10:17:32 -060026readonly CIPD_ROOT="${script_dir}/.cipd_bin"
Prathmesh Prabhu42207542020-04-20 23:13:23 -070027cipd ensure \
28 -log-level warning \
David Burger7f5a8fb2020-06-01 10:17:32 -060029 -root "${CIPD_ROOT}" \
Prathmesh Prabhu42207542020-04-20 23:13:23 -070030 -ensure-file - \
31 <<ENSURE_FILE
Sean McAllister8704ebd2021-06-23 13:38:27 -060032fuchsia/third_party/jq/\${platform} latest
Prathmesh Prabhu42207542020-04-20 23:13:23 -070033infra/tools/protoc/\${platform} protobuf_version:${CIPD_PROTOC_VERSION}
34chromiumos/infra/tools/protoc-gen-go version:${CIPD_PROTOC_GEN_GO_VERSION}
35infra/3pp/tools/go/\${platform} latest
Sean McAllister1144d542021-07-28 08:09:59 -060036infra/3pp/go/github.com/bufbuild/buf/\${platform} version:2@${CIPD_BUF_VERSION}
Prathmesh Prabhu42207542020-04-20 23:13:23 -070037ENSURE_FILE
David Burger94ed6db2020-07-20 11:57:44 -060038PATH="${CIPD_ROOT}/bin:${CIPD_ROOT}:${PATH}"