Created
April 8, 2021 17:17
-
-
Save hmanzur/4e5aa7edb782715779d4859a61b96de4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: 'gcr.io/cloud-builders/gcloud' | |
entrypoint: 'bash' | |
args: | |
- '-c' | |
- | | |
# File that contains failures. | |
failure_file=failure.log | |
touch ${failure_file} | |
for d in portal/*/; do | |
config="${d}cloudbuild.yaml" | |
if [[ ! -f "${config}" ]]; then | |
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." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment