You are using Cloud Build to create a new Docker image on each source code commit to a Cloud Source Repositories 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?
Click on the arrows to vote for the correct answer
A. B. C. D.C.
https://docs.docker.com/docker-hub/builds/Option B, "Create a build trigger on a Git tag pattern. Use a Git tag convention for new releases," is the correct choice.
To understand why, let's break down each option:
A. Manually trigger the build for new releases. This option is not automated, so it does not satisfy the requirement of automating the release process. Also, it is error-prone and not scalable in a large development environment.
B. Create a build trigger on a Git tag pattern. Use a Git tag convention for new releases. This option is a good fit because it uses Git tags to trigger the release process, which is a common practice. When developers want to release a specific commit, they can create a Git tag with a specific naming convention, such as "release-1.0.0," and Cloud Build can be configured to trigger a build when a new tag is created with this convention. This option automates the release process, eliminates human error, and is easily scalable.
C. Create a build trigger on a Git branch name pattern. Use a Git branch naming convention for new releases. This option is not a good fit because it uses Git branches to trigger the release process, which is not common practice. Branches are typically used for ongoing development work, whereas tags are used for specific releases. This option also requires developers to follow a specific branch naming convention, which may not be feasible in a large development environment.
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. This option is not necessary because it creates additional complexity by introducing a second repository and a second Cloud Build trigger. It also does not address the automation requirement of the release process.
In summary, option B is the best fit because it uses Git tags, which is a common practice for releases, and satisfies the requirement of automating the release process.