0
0
GCPcloud~20 mins

Build triggers configuration in GCP - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Build Trigger Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
service_behavior
intermediate
2:00remaining
Trigger Behavior on Branch Push
You configure a Cloud Build trigger to start a build when code is pushed to the 'main' branch. What happens if a push is made to the 'develop' branch?
AThe build trigger activates and starts a build.
BThe build trigger activates but the build fails immediately.
CThe build trigger does not activate; no build starts.
DThe build trigger activates only if the commit message contains 'build'.
Attempts:
2 left
💡 Hint
Triggers can be set to watch specific branches only.
Configuration
intermediate
2:00remaining
YAML Trigger Configuration for Tag Push
Which YAML snippet correctly configures a Cloud Build trigger to start a build only when a tag matching 'v*' is pushed?
A
triggerTemplate:
  repoName: my-repo
  branchName: 'main'
B
triggerTemplate:
  repoName: my-repo
  branchName: 'v*'
C
triggerTemplate:
  repoName: my-repo
  tagName: 'release-*'
D
triggerTemplate:
  repoName: my-repo
  tagName: 'v*'
Attempts:
2 left
💡 Hint
Tags and branches use different fields in trigger configuration.
Architecture
advanced
2:00remaining
Best Trigger Setup for Multiple Environments
You have three environments: dev, staging, and production. You want builds to trigger automatically on pushes to branches 'dev', 'staging', and 'main' respectively, each deploying to its environment. What is the best way to configure Cloud Build triggers?
ACreate one trigger watching all branches and use build steps to deploy based on branch name.
BCreate three separate triggers, each watching one branch and deploying to its environment.
CCreate one trigger watching the 'main' branch and manually deploy dev and staging builds.
DCreate triggers only for 'main' and 'staging' branches; dev builds run manually.
Attempts:
2 left
💡 Hint
Separate triggers simplify environment-specific builds and deployments.
security
advanced
2:00remaining
Securing Build Triggers from Unauthorized Changes
How can you prevent unauthorized users from modifying Cloud Build triggers in a shared project?
AUse IAM to restrict 'Cloud Build Admin' role only to trusted users.
BGrant all users the 'Cloud Build Editor' role.
CDisable triggers and run builds manually.
DStore trigger configurations in a public GitHub repo.
Attempts:
2 left
💡 Hint
Control permissions carefully with IAM roles.
Best Practice
expert
2:00remaining
Optimizing Build Trigger Performance
You notice your Cloud Build triggers start builds for every commit, causing long queues and high costs. Which configuration change best reduces unnecessary builds?
AConfigure triggers to only activate on changes to specific paths or files.
BIncrease the number of concurrent builds allowed.
CDisable triggers and run builds on a schedule.
DUse a single trigger for all branches without filters.
Attempts:
2 left
💡 Hint
Filtering triggers by file changes reduces builds.