blob: 2fa41fd6c64e2f859f497cd4f4bfae157932debf [file] [log] [blame]
substitutions:
_TAG_NAME: ${COMMIT_SHA}
_BUILD_TOOLS_CACHE: 'https://storage.googleapis.com/cos-infra-prod_cloudbuild/cos-tools-cache'
steps:
- name: 'gcr.io/cloud-builders/docker'
entrypoint: 'bash'
args:
- '-c'
- |
cat <<EOF | docker build -t bazel -
FROM gcr.io/cloud-builders/bazel
RUN apt-get update && apt-get install -y mtools
EOF
- name: 'bazel'
args: [ 'test', '--test_output=all', '--remote_cache=${_BUILD_TOOLS_CACHE}', '--google_default_credentials', '--spawn_strategy=standalone','--','...','-//src/pkg/tools/...' ]
- name: 'golang'
entrypoint: 'bash'
args: [ './run_unit_tests.sh' ]
- 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=${_TAG_NAME} > ${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