| steps: |
| - name: 'gcr.io/cloud-builders/gcloud' |
| entrypoint: 'bash' |
| args: |
| - '-c' |
| - | |
| # File that contains failures. |
| failure_file=failure.log |
| touch ${failure_file} |
| |
| for d in src/cmd/*/; do |
| config="${d}cloudbuild.yaml" |
| if [[ ! -f "${config}" ]]; then |
| continue |
| fi |
| |
| echo "Building $d ... " |
| ( |
| logfile="${d::-1}.log" |
| gcloud builds submit --config=${config} --project=${PROJECT_ID} --substitutions=_OUTPUT_PROJECT=${_OUTPUT_PROJECT},TAG_NAME=${COMMIT_SHA} > ${logfile} 2>&1 |
| if [[ $? -ne 0 ]]; then |
| echo "$d failed" | tee -a ${failure_file} |
| cat ${logfile} |
| else |
| echo "$d finished" |
| 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." |
| |
| timeout: 7200s |