forked from GoogleCloudPlatform/cloud-builders-community
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cloudbuild.yaml
58 lines (49 loc) · 1.47 KB
/
cloudbuild.yaml
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
48
49
50
51
52
53
54
55
56
57
58
steps:
# Add some checks around examples.
- name: 'gcr.io/cloud-builders/gcloud'
entrypoint: 'bash'
args:
- '-c'
- |
# File that contains failures.
failure_file=failure.log
touch ${failure_file}
# Loop through the builders, and build independently.
for d in */; do
readme="${d}README.md"
if [[ ! -f "${readme}" ]]; then
# Note the error but try to build anyway.
echo "${d}: ${readme} not found." | tee -a ${failure_file}
fi
config="${d}cloudbuild.yaml"
if [[ ! -f "${config}" ]]; then
echo "${d} failed: ${config} not found." | tee -a ${failure_file}
continue
fi
# The android builder assumes a local installation of Android SDK which is
# not a valid assumption.
if [[ "${d}" == "android/" ]]; then
echo "Skipping $d"
continue
fi
echo "Building $d ... "
(
logfile="${d::-1}.log" # Logfile for "foo/" builder is "foo.log".
gcloud builds submit $d --config=${config} > ${logfile} 2>&1
if [[ $? -ne 0 ]]; then
echo "$d failed" | tee -a ${failure_file}
cat ${logfile}
fi
) &
done
wait
# Check if there is any failure.
if [[ -s ${failure_file} ]]; then
echo
echo "Some builds failed:"
cat ${failure_file}
echo "Exiting."
exit 1
fi
echo "All builds succeeded."
tags: ['$_PR_NUMBER', '$_REPO_OWNER', '$_REPO', '$_SHA', 'cloud-builders-community']