GOOGLE-PROFESSIONAL-CLOUD-DEVELOPER practice question 21 of 35

You are using Cloud Build to create a new Docker image on each source code commit to a Cloud Source Repositoties repository. Your application is built on every commit to the master branch. You want to release specific commits made to the master branch in an automated method. What should you do?

Full set: 265 questions
Answer options
A: Manually trigger the build for new releases.
B: Create a build trigger on a Git tag pattern. Use a Git tag convention for new releases. Correct answer
C: Create a build trigger on a Git branch name pattern. Use a Git branch naming convention for new releases.
D: Commit your source code to a second Cloud Source Repositories repository with a second Cloud Build trigger. Use this repository for new releases only.
Correct Answer:
B. Create a build trigger on a Git tag pattern. Use a Git tag convention for new releases.
Explanation

The most effective and standard method for releasing specific versions of software from a source control repository is by using Git tags. A Git tag marks a specific point in the repository's history, typically used to denote a release version (e.g., v1.0.1). Cloud Build natively supports creating triggers that activate when a new tag matching a specified pattern is pushed to the repository. By adopting a tag convention for releases (e.g., v or release-), you can create a dedicated Cloud Build trigger that automatically initiates the release process only for commits that have been explicitly tagged, fulfilling the requirement for an automated method to release specific commits.

Why Incorrect

A. Manually triggering a build is not an automated method and is prone to human error, which contradicts the core requirement of the question.
C. While using release branches is a valid Git workflow (like GitFlow), tags are the more direct and idiomatic Git feature for marking a single, specific commit as a release point.
D. Using a second repository for releases introduces unnecessary complexity, code duplication, and potential synchronization issues, which is not a recommended software development practice.

References

1. Google Cloud Documentation - Create and manage build triggers: This document explicitly lists the types of events that can start a build, including pushing a new tag. It states, "You can configure triggers to automatically run builds on Git repository changes, such as when a commit is pushed to a branch or a tag is pushed." The section "Create a Git tag trigger" details the exact process described in the correct answer.

Source: Google Cloud Documentation, "Create and manage build triggers", Section: "Create a Git tag trigger".

2. Google Cloud Documentation - CI/CD with Cloud Build and GKE: In tutorials demonstrating CI/CD pipelines, Google often uses Git tags to trigger deployments for specific releases. For example, a common pattern shown is having one trigger for continuous integration on every commit and a separate trigger on tags for continuous deployment/release.

Source: Google Cloud Solutions, "CI/CD on Google Cloud", Section: "Continuous delivery with Cloud Build".

3. Pro Git Book (Academic Resource): While not a Google-specific document, this widely respected book, often used in university courses, establishes the standard use case for Git tags. Chapter 2.6, "Git Basics - Tagging," explains, "Like most VCSs, Git has the ability to tag specific points in a repository’s history as being important... people typically use this functionality to mark release points (v1.0, v2.0 and so on)."

Source: Scott Chacon & Ben Straub, Pro Git, 2nd ed. (Apress, 2014), Chapter 2.6, "Git Basics - Tagging".

Scroll to Top