Skip to content

Instantly share code, notes, and snippets.

@ajiteshk
Created August 1, 2022 04:41
Show Gist options
  • Save ajiteshk/af27d782579a89387daa4d4e2a3e51e3 to your computer and use it in GitHub Desktop.
Save ajiteshk/af27d782579a89387daa4d4e2a3e51e3 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