blob: 9f52dad0bebc4a7a44cde1d209d52f29d9299277 [file] [log] [blame]
substitutions:
_TAG_NAME: ${SHORT_SHA}-${BUILD_ID}
_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 dosfstools
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' ]
# Run cos-customizer integration tests
- name: 'gcr.io/cloud-builders/gcloud'
entrypoint: 'bash'
args: [ './run_tests.sh', '-p', '$PROJECT_ID']
- 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