-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cloudbuild.yaml
37 lines (35 loc) · 1.13 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
steps:
- name: gcr.io/google.com/cloudsdktool/cloud-sdk:alpine
entrypoint: 'ash'
args:
- '-c'
- |
# File that contains failures.
failure_file=failure.log
touch ${failure_file}
# Loop through the builders, and build independently.
for f in $(find . -mindepth 2 -type f -name 'cloudbuild.yaml');
do
echo "Building ${f%/*} ... "
(
if [[ -s ${f%/*}/TAG.txt ]]; then
gcloud builds submit ${f%/*} --config=${f} --gcs-log-dir="gs://${PROJECT_ID}-cloudbuild/logs" --substitutions _TAG=$(cat ${f%/*}/TAG.txt) 2>&1 > /dev/null
else
gcloud builds submit ${f%/*} --config=${f} --gcs-log-dir="gs://${PROJECT_ID}-cloudbuild/logs" 2>&1 > /dev/null
fi
if [[ $? -ne 0 ]]; then
echo "${f%/*} failed" >> ${failure_file}
fi
) &
done
wait
# Check if there is any failure.
if [[ -s ${failure_file} ]]; then
echo "Some builds failed:"
cat ${failure_file}
echo "Exiting."
exit 1
fi
echo "All builds succeeded."
tags: ['cloud-builder']
timeout: 3600s