Google Professional Cloud Developer Question 261
Select 3Google Cloud PlatformYou are developing a CI/CD pipeline for a microservices architecture hosted on Google Cloud. The pipeline uses Cloud Build to build and test the code. Currently, the build times are significantly long, slowing down the deployment process. Which actions should you take to optimize the build times without compromising functionality?
- A
Enable build caching in Cloud Build to reuse artifacts from previous builds.
- B
Break the monolithic build configuration into smaller, service-specific configurations.
- C
Switch to a larger machine type for Cloud Build to increase build speed.
- D
Run unit tests and integration tests on separate build steps to parallelize execution.
- E
Store build logs in a regional Cloud Storage bucket to reduce latency.
Show answer and explanation
Correct answers: A, B, D
Explanation
Optimizing build times in Cloud Build involves strategies like enabling caching to avoid redundant work, splitting build configurations to focus on specific services, and parallelizing tests to reduce overall execution time. These actions ensure faster builds without compromising the quality or functionality of the pipeline. While other options may improve resource usage or log access, they do not directly contribute to build time optimization.
- A. Correct.
Enabling build caching allows Cloud Build to reuse intermediate artifacts from previous builds, which can significantly reduce build times for projects with unchanged components.
- B. Correct.
Breaking the build configuration into smaller, service-specific builds allows individual services to be built independently, reducing unnecessary work and optimizing build times.
- C. Incorrect.
Switching to a larger machine type may increase resource capacity but does not directly address build time optimization strategies such as caching or parallelization.
- D. Correct.
Separating unit tests and integration tests into parallel build steps can speed up the testing phase by utilizing multiple workers concurrently.
- E. Incorrect.
Storing build logs in a regional Cloud Storage bucket reduces latency for log access but does not impact the actual build process or its duration.