version 1
steps:- name: 'bash' args: ['echo', 'I am running a bash command']
version 2
steps:
- name: 'gcr.io/cloud-builders/gcloud'
- entrypoint: 'bash'
- args:
- '-eEuo'
- 'pipefail'
- '-c'
- |-
if (( $(date '+%-e') % 2 )); then
echo "today is an odd day"
else
echo "today is an odd day, with an even number"
fi
- name: another example
image: gcr.io/ubuntu:latest
command: ["/bin/sh"]
args:
- '-c'
- |
DB_PATH="mysql://${MASTER_DSN}"
echo "hello world!"
imagePullPolicy: Always
env:
- name: MASTER_DSN
Another example
steps:
- name: 'gcr.io/cloud-builders/curl'
entrypoint: 'bash'
args:
- '-c'
- |
PET="$$(curl -s https://pets.doingdevops.com/pet_flaky --max-time 10)"
while [ "$$PET" == "ERROR" ] ; do
echo "Error: API failed to respond with a pet! Try again..."
PET="$$(curl -s https://pets.doingdevops.com/pet_flaky --max-time 10)"
done
echo "Success! $${PET}"