Created
August 10, 2019 05:41
-
-
Save tmaiaroto/86322561c8fd0d33d009a8b34c712c24 to your computer and use it in GitHub Desktop.
GCP Cloud Build - multiple builds from directories
This file contains hidden or 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
# If a directory has a cb-deploy.yaml file, it will run for CD | |
steps: | |
- name: 'gcr.io/cloud-builders/gcloud' | |
entrypoint: 'bash' | |
args: | |
- '-c' | |
- | | |
for d in */; do | |
config="${d}cb-deploy.yaml" | |
if [[ ! -f "${config}" ]]; then | |
continue | |
fi | |
echo "Building and deploying $d ... " | |
if [[ -z "${SHORT_SHA}" ]] | |
then | |
echo "==== $SHORT_SHA NOT FOUND - USING CLOUD BUILD LOCAL ====" | |
cloud-build-local --config=cb-deploy.yaml --dryrun=false --push $d | |
else | |
( | |
gcloud builds submit $d --config=${config} | |
) & | |
fi | |
done | |
wait | |
options: | |
substitution_option: 'ALLOW_LOOSE' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Unfortunately, without a custom builder, this won't work with Cloud Build Local because
cloud-build-local
requires Docker.... Docker in Docker.