Google Professional Cloud Developer Question 242
Select 3Google Cloud PlatformYou are managing a CI/CD pipeline for a Google Cloud project and need to ensure that your source code is versioned properly, changes are reviewed before being merged, and deployments are automatically triggered after code changes. Which source control management practices should you implement?
- A
Use Git branches to separate feature development from the main branch.
- B
Enable automatic commits to the main branch after every code change.
- C
Set up pull requests with mandatory code reviews before merging.
- D
Use tags in Git to mark specific versions of the codebase.
- E
Disable branch protection rules to speed up the deployment process.
Show answer and explanation
Correct answers: A, C, D
Explanation
The best practices for source control management in a CI/CD pipeline include using Git branches to separate development efforts, enforcing pull requests with mandatory code reviews, and tagging specific versions of the codebase. These practices ensure code quality, stability, and traceability, which are essential for maintaining robust and reliable software in a Google Cloud project. Avoid bypassing review processes or disabling branch protection rules, as they compromise the integrity of the codebase.
- A. Correct.
Using Git branches to separate feature development from the main branch is a recommended best practice to manage the development workflow and avoid disrupting the production-ready code.
- B. Incorrect.
Automatic commits to the main branch after every code change bypass code review processes, which can lead to undetected errors and is not a best practice.
- C. Correct.
Setting up pull requests with mandatory code reviews ensures that all changes are vetted by team members, improving code quality and reducing bugs.
- D. Correct.
Using tags in Git to mark specific versions of the codebase helps in tracking releases and identifying stable versions, which is essential for effective source control management.
- E. Incorrect.
Disabling branch protection rules undermines the integrity of the repository by allowing unreviewed changes to be merged directly, which can lead to critical issues in the codebase.