2019-06-18 17:46:37 +00:00
|
|
|
#!/bin/bash
|
2022-03-03 15:42:57 +00:00
|
|
|
# Copyright 2022 Google LLC
|
2019-06-18 17:46:37 +00:00
|
|
|
#
|
|
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
|
|
# found in the LICENSE file.
|
2022-03-03 15:42:57 +00:00
|
|
|
#
|
|
|
|
# Takes two arguments.
|
|
|
|
# First argument is the output directory where executables are to be placed.
|
|
|
|
# Second (optional) argument is the target platform. These are formatted as os_arch
|
|
|
|
# https://github.com/bazelbuild/rules_go/blob/e9a7054ff11a520e3b8aceb76a3ba44bb8da4c94/go/toolchain/toolchains.bzl#L22
|
2019-06-18 17:46:37 +00:00
|
|
|
|
|
|
|
set -x -e
|
|
|
|
|
2022-03-03 15:42:57 +00:00
|
|
|
# Navigate to the root of the infra checkout.
|
|
|
|
cd $(dirname ${BASH_SOURCE[0]})
|
|
|
|
cd ../..
|
2020-04-28 11:14:22 +00:00
|
|
|
|
2022-03-03 15:42:57 +00:00
|
|
|
PLATFORM=${2:-linux_amd64} # use linux_amd64 if not specified
|
2021-02-01 10:46:41 +00:00
|
|
|
|
2022-03-03 15:42:57 +00:00
|
|
|
# Build the executables and extract them to the folder in the first argument.
|
2022-03-29 12:33:06 +00:00
|
|
|
# We specify the cache directory to be somewhere other than the default (home directory)
|
|
|
|
# Because the home directory is mounted on / which typically does not have a lot of disk space.
|
|
|
|
# /mnt/pd0 is the bigger disk mounted to the GCE VM.
|
|
|
|
# https://bazel.build/docs/output_directories#layout
|
|
|
|
bazelisk --output_user_root=/mnt/pd0/bazel_cache \
|
2022-03-29 15:49:27 +00:00
|
|
|
build //infra/bots:all_task_drivers --platforms=@io_bazel_rules_go//go/toolchain:${PLATFORM} \
|
|
|
|
--config=linux-rbe
|
2022-03-29 12:33:06 +00:00
|
|
|
|
2022-03-03 15:42:57 +00:00
|
|
|
tar -xf bazel-bin/infra/bots/built_task_drivers.tar -C ${1}
|
|
|
|
# Bazel outputs are write-protected, so we make sure everybody can write them. This way there
|
|
|
|
# are no expected errors in deleting them later.
|
|
|
|
chmod 0777 ${1}/*
|