Skip to content

Commit aaf1d31

Browse files
meringhsudhof
authored andcommitted
Improve cloudbuild
This gets rid of duplicate code. Change-Id: Ia9e72d97f599bfe29dd6c9f84eb3e21229f72679
1 parent 6fc7062 commit aaf1d31

File tree

2 files changed

+7
-49
lines changed

2 files changed

+7
-49
lines changed

cloudbuild.sh

+2-45
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,8 @@
11
#!/bin/bash -e
22

3-
# Build script for Google Cloud Build
3+
./cloudbuild_setup.sh
44

5-
function log() {
6-
d=$(date +'%Y-%m-%d %H:%M:%S')
7-
echo $d" "$1
8-
}
9-
10-
log "Running Copybara tests"
11-
12-
log "Fetching dependencies"
13-
log "Running apt-get update --fix-missing"
14-
15-
apt-get update --fix-missing
16-
apt-get install locales
17-
apt-get -y install mercurial
18-
apt-get install -y lsb-release
19-
apt-get install -y software-properties-common
20-
21-
add-apt-repository ppa:git-core/ppa -y
22-
apt install git -y
23-
24-
apt-get -y install quilt
25-
26-
log "Extracting Bazel"
27-
# Only because first time it extracts the installation
28-
bazel version
29-
30-
echo "-----------------------------------"
31-
echo "Versions:"
32-
lsb_release -a
33-
hg --version | grep "(version" | sed 's/.*[(]version \([^ ]*\)[)].*/Mercurial: \1/'
34-
git --version | sed 's/git version/Git:/'
35-
bazel version | grep "Build label" | sed 's/Build label:/Bazel:/'
36-
java -version
37-
echo "Quilt:"
38-
quilt --version
39-
echo "-----------------------------------"
40-
41-
log "Setting Locale"
42-
export LANGUAGE=en_US.UTF-8
43-
export LANG=en_US.UTF-8
44-
export LC_ALL=en_US.UTF-8
45-
locale-gen en_US.UTF-8
46-
update-locale LANG=en_US.UTF-8
47-
48-
echo "Running 'bazel $@'"
5+
log "Running 'bazel $@'"
496
time bazel "$@"
507

518
log "Done"

cloudbuild_setup.sh

+5-4
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@ log "Fetching dependencies"
1313
log "Running apt-get update --fix-missing"
1414

1515
apt-get update --fix-missing
16-
apt-get install locales
17-
apt-get -y install mercurial
18-
apt-get -y install software-properties-common
16+
apt-get install -y locales
17+
apt-get install -y mercurial
18+
apt-get install -y lsb-release
19+
apt-get install -y software-properties-common
1920

2021
add-apt-repository ppa:git-core/ppa -y
2122
apt install git -y
2223

23-
apt-get -y install quilt
24+
apt-get install -y quilt
2425

2526
log "Extracting Bazel"
2627
# Only because first time it extracts the installation

0 commit comments

Comments
 (0)