Google Professional Cloud Developer Question 260
Select 3Google Cloud PlatformYou are developing a CI/CD pipeline for a Python-based application hosted on Google Cloud. The build times have become excessively long, and you need to optimize the build process. Which of the following actions should you take to reduce the build time without compromising the build quality?
- A
Enable caching for dependencies to avoid re-downloading unchanged libraries.
- B
Use Google Cloud Build’s parallel build steps to execute independent tasks concurrently.
- C
Switch to a local build environment instead of using Google Cloud Build.
- D
Configure a custom base image with pre-installed dependencies for the application.
- E
Disable unit tests during the build process to save time.
Show answer and explanation
Correct answers: A, B, D
Explanation
Optimizing build times involves leveraging caching, parallelization, and pre-built components to reduce redundant work during builds. Actions like enabling dependency caching, using parallel build steps, and creating custom base images address the root causes of slow builds while maintaining build quality. Removing essential steps like unit testing or switching to local environments is not a recommended approach.
- A. Correct.
Caching dependencies helps avoid re-downloading the same libraries for every build, significantly speeding up the process.
- B. Correct.
Using parallel build steps in Google Cloud Build allows independent tasks, such as running tests and building artifacts, to run simultaneously, reducing overall build time.
- C. Incorrect.
Switching to a local build environment introduces inconsistencies and reduces the reproducibility of builds, which is not recommended.
- D. Correct.
Using a custom base image with pre-installed dependencies reduces the time spent installing dependencies during the build process.
- E. Incorrect.
Disabling unit tests compromises build quality and can lead to undetected bugs. Build optimization should not involve sacrificing testing.