Ch 3 ยท Continuous Integration
From the trenches
14 / 32

An unfiltered branch trigger is a budget incident waiting to happen.

Six trigger types exist โ€” push, pull request, tag, manual, webhook, Pub/Sub โ€” and filtering push triggers is the cheap fix.

A trigger fired on push to any branch. A contractor pushed 40 commits to an experimental branch in one afternoon โ€” 40 full builds burned the monthly Cloud Build budget in a day and pushed 40 untagged images into the shared registry.
fix: one line
gcloud builds triggers create github \
  --branch-pattern="^main$"  # reserve PR triggers for feature branches