Skip to content

Instantly share code, notes, and snippets.

@dln
Created September 21, 2021 20:03
Show Gist options
  • Save dln/5b74dfe5b9d40b95a301489c1a525f27 to your computer and use it in GitHub Desktop.
Save dln/5b74dfe5b9d40b95a301489c1a525f27 to your computer and use it in GitHub Desktop.
Cloud Build on a Schedule, without Trigger.
PROJECT_ID=myproject
gcloud scheduler jobs create http ${PROJECT_ID}-run-build \
--schedule='1 12 * * *' \
--uri=https://cloudbuild.googleapis.com/v1/projects/${PROJECT_ID}/builds?alt=json \
--message-body-from-file=- \
--oauth-service-account-email=${PROJECT_ID}@appspot.gserviceaccount.com \
--oauth-token-scope=https://www.googleapis.com/auth/cloud-platform \
<<EOF
{ "steps": [
{
"id": "hello cron",
"name": "alpine",
"args": ["echo", "Hello schedule"]
}]
}
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment