Skip to content

Instantly share code, notes, and snippets.

@ajiteshk
Created August 1, 2022 04:41
Show Gist options
  • Save ajiteshk/6c0915eec428aa1dcea7a1ddda39415a to your computer and use it in GitHub Desktop.
Save ajiteshk/6c0915eec428aa1dcea7a1ddda39415a to your computer and use it in GitHub Desktop.
steps:
- name: 'gcr.io/cloud-builders/git'
entrypoint: /bin/bash
args:
- -c
- |
git fetch --depth=2 origin main
echo hello
git log
git --no-pager diff --name-only HEAD^ HEAD | grep "/" | cut -d/ -f1 | sort | uniq > /workspace/diff.txt
- name: 'gcr.io/cloud-builders/gcloud'
entrypoint: /bin/bash
args:
- -c
- |
while read line
do
config="${line}/cloudbuild.yaml"
echo $config
if [[ ! -f "${config}" ]]; then
echo "no such file"
continue
fi
gcloud builds submit $line --config=${config}
done < /workspace/diff.txt
options:
logging: CLOUD_LOGGING_ONLY
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment