You are using Cloud Build to build a Docker image. You need to modify the build to execute unit and run
integration tests. When there is a failure, you want the build history to clearly display the stage at which the
build failed.
What should you do?
Suggested Answer: D
Get Premium Professional Cloud Developer Questions
as Interactive Web-Based Practice Test or PDF
Real Exam Format
Detailed Explanations
Instant Access
Get Your Practice Test
25 comments · newest first
ID
Idella
3 months ago
Totally! Clear logs will help us debug faster.
SH
Shawnda
3 months ago
I agree! Using build steps for unit and integration tests is key.
QU
Quiana
4 months ago
Yeah, that way we can see exactly where it fails.
MO
Mollie
5 months ago
I think we should add a test stage in the Cloud Build config.
DO
Dong
5 months ago
I thought Cloud Build only showed the final result, not stages?
NG
Nguyet
5 months ago
Make sure to use the right logging for better visibility.
MO
Mona
6 months ago
Wait, can you really see the exact stage of failure?
AS
Ashleigh
6 months ago
Totally agree, that’s the best way to track failures!
GI
Gilberto
6 months ago
Just add a testing step in your Cloud Build config.
AL
Alyce
6 months ago
Haha, I bet the answer involves using the `gcloud` command-line tool. That's always the solution, isn't it?
BO
Bok
6 months ago
Isn't there a way to set up custom build steps to run the tests and handle the failure reporting?
VA
Val
6 months ago
The `--status=FAILURE` option should give us the stage where the build failed.
LE
Lemuel
7 months ago
I think we should use the `--failure-detail` flag to get more information on the build failure.
TW
Twana
7 months ago
I think we should use the `--fail-fast` option or something similar to stop the build on the first failure, but I’m not 100% clear on how that integrates with Cloud Build.
TR
Truman
7 months ago
I’m a bit confused about how to handle failures in the build process. Do we need to set up a specific command to fail the build if the tests don’t pass?
GL
Gladys
8 months ago
I remember practicing a similar question where we had to set up different build steps. We might need to use the `steps` section to define the test commands.
LE
Leah
8 months ago
I think we need to add a step in the Cloud Build configuration to run the tests after the image is built, but I'm not entirely sure how to specify that in the YAML file.
PA
Pamella
8 months ago
I'm a bit confused on how to set the 'failure_condition' properly. I'll need to double-check the syntax and make sure I'm handling any test failures correctly.
BR
Brandee
8 months ago
Good idea, Michael. That way the build history will clearly show where the build failed. I'm going to try that approach and see if I can get it working.
EL
Elly
8 months ago
Okay, I think I've got a plan. I'll add a 'test' step that runs the unit and integration tests, and then set the 'failure_condition' property to indicate that the build should fail if any of the tests fail.
EL
Elmer
9 months ago
Hmm, I'm not sure how to set that up in Cloud Build. I'll need to review the documentation on the available build steps and how to configure them.
RO
Rodolfo
9 months ago
This seems straightforward. I'd start by adding a test stage to the build config to run the unit and integration tests.
DO
Dottie
3 months ago
And set the build to fail on test errors!
AL
Almeta
3 months ago
Definitely! Make sure to log the results.
ST
Stevie
3 months ago
Adding a test stage sounds good.