blob: 46cf1be1f0b5d5dc1d0fd93e81f562f293d92c81 [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'
24
David Burger7f5a8fb2020-06-01 10:17:32 -060025readonly CIPD_ROOT="${script_dir}/.cipd_bin"
Prathmesh Prabhu42207542020-04-20 23:13:23 -070026cipd ensure \
27 -log-level warning \
David Burger7f5a8fb2020-06-01 10:17:32 -060028 -root "${CIPD_ROOT}" \
Prathmesh Prabhu42207542020-04-20 23:13:23 -070029 -ensure-file - \
30 <<ENSURE_FILE
31infra/tools/protoc/\${platform} protobuf_version:${CIPD_PROTOC_VERSION}
32chromiumos/infra/tools/protoc-gen-go version:${CIPD_PROTOC_GEN_GO_VERSION}
33infra/3pp/tools/go/\${platform} latest
34ENSURE_FILE
David Burger94ed6db2020-07-20 11:57:44 -060035PATH="${CIPD_ROOT}/bin:${CIPD_ROOT}:${PATH}"