mediumMultiple ChoiceObjective-mapped
Google ACE Practice Question: A team's Cloud Build pipeline must: (1) run unit…
A team's Cloud Build pipeline must: (1) run unit tests, (2) build a Docker image only if tests pass, (3) push the image to Artifact Registry. Which cloudbuild.yaml structure correctly enforces this sequential dependency?
⚠ Common exam trap
Google Cloud often tests the misconception that you must explicitly use `waitFor` to enforce step dependencies, when in fact Cloud Build runs steps in a list sequentially by default and stops on failure.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Define all three steps in a single `steps` list — they run sequentially by default and stop on failure
Cloud Build executes steps in a `steps` list sequentially by default, and any step that exits with a non-zero status (e.g., test failure) immediately stops the entire pipeline. This enforces the required dependency: unit tests must pass before the Docker image is built, and the image must be built before it is pushed to Artifact Registry.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
Define all three steps in a single `steps` list — they run sequentially by default and stop on failure
Why this is correct
Defining all three steps in a single `steps` list is the idiomatic Cloud Build approach because each step runs as its own container sequentially, in the order they appear. The build automatically stops at the first step that exits with a non-zero status, so a failing test prevents the build and push steps from ever executing. This implicit sequential ordering and fail-fast behavior exactly enforces the test-before-build-before-push dependency without any extra configuration.
- ✗
Use `waitFor` with step IDs to create a dependency graph between all three steps
Why it's wrong here
`waitFor` is designed to declare explicit dependencies when you want steps to run in parallel or to break the default sequential order. For three steps that must run one after another, those dependencies already exist implicitly, so adding `waitFor` is redundant and adds maintenance overhead. If you included `waitFor` on every step you would essentially be re-implementing the default behavior; it doesn't change the fact that steps stop on failure, and it introduces a risk of referencing an incorrect step ID. A simple ordered list is simpler and less error-prone.
- ✗
Define the steps in three separate cloudbuild.yaml files and chain them with Cloud Composer
Why it's wrong here
Chaining three separate `cloudbuild.yaml` files with Cloud Composer is a heavy-handed solution that introduces an external orchestration service where none is needed. Each build invocation runs in a separate workspace, so you would have to explicitly persist and retrieve artifacts across builds, duplicating state and adding failure points. Cloud Build steps in one file already share a `/workspace` volume, letting the test step's results and the build step's outputs remain available to the next step without any export/import. For a linear sequence, a single file is simpler, cheaper, and more reliable.
- ✗
Set `parallel: false` at the top level of cloudbuild.yaml to enforce sequential execution
Why it's wrong here
There is no top-level `parallel: false` field in the `cloudbuild.yaml` schema; Cloud Build steps are sequential by default, so the field is unnecessary and would be rejected by the schema validation. If you want parallel execution, you opt in by using `waitFor` to define a dependency graph; otherwise, the engine runs steps in array order. Trying to set this non-existent property can break your build configuration, and it indicates a misunderstanding of the execution model. The correct way to enforce the desired order is simply to list the steps in order in the `steps` array.
Go deeper
Related to this question
Learn chapter
Google Cloud Platform Overview
Key term
Cloud Build
Cloud Build is a managed service that compiles source code into deployable artifacts, often used in continuous integration and continuous delivery pipelines.
Key term
Artifact Registry
Artifact Registry is a managed service for storing, managing, and securing container images and other software packages in a centralized repository.
About these practice questions
One of 769 original ACE practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This ACE practice question is part of Courseiva's free Google Cloud certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the ACE exam.