forked from GoogleContainerTools/base-images-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap_image.sh
executable file
·47 lines (40 loc) · 1.27 KB
/
bootstrap_image.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
set -xe
# This script kicks of the bootstrap image macro with the right flags.
while getopts t:g:d option
do
case "${option}"
in
t) TARGET=${OPTARG};;
g) GIT_ROOT=${OPTARG};;
d) DEBUG="--verbose_failures --sandbox_debug";;
*) echo "Invalid option"; exit 1;;
esac
done
# Error out if -t does not exists
if [ -z "${TARGET}" ]; then
echo """
$(basename "$0") <Mandatory_args> <Optional_args>
Mandatory Args
-t <bootstrap_image_macro>
Optional Args
-g <git_root> Local Git root location
-d Add debug options to bazel command
"""
exit 1
fi
if [ -z "${GIT_ROOT}" ]; then
GIT_ROOT=$(git rev-parse --show-toplevel)
fi
echo "Running bazel build ${TARGET}"
# shellcheck disable=SC2086
bazel build "${TARGET}" \
--action_env=GIT_ROOT="${GIT_ROOT}" \
--sandbox_writable_path="${GIT_ROOT}" ${DEBUG}
# get rid of running this once we figure out how to make put_status output mandatory in bootstrap_image.
echo "Running bazel build ${TARGET}_fetch to make we store the downloaded packages in the store back"
# shellcheck disable=SC2086
bazel build "${TARGET}_fetch" \
--action_env=GIT_ROOT="${GIT_ROOT}" \
--sandbox_writable_path="${GIT_ROOT}" ${DEBUG}
echo "Please run 'git status' and 'git commit' commands to commit the downloaded packages to the git repository"