A company stores source code and unit tests in an AWS CodeCommit repository. A CodePipeline pipeline triggers a CodeBuild project when code is merged to the main branch. The CodeBuild project must run the unit tests and, if they pass, tag the latest commit in the CodeCommit repository. How should the CodeBuild project be set up to accomplish this?
Choose an answer
Tap an option to check your answer.
Correct answer: Configure the CodeBuild project to use native Git to clone the CodeCommit repository, run the unit tests, and use native Git to create and push a tag to the repository if the tests pass..
Why this is the answer
The correct approach is to use native Git commands within the CodeBuild project. CodeBuild environments come pre-installed with Git. You can configure CodeBuild to clone the CodeCommit repository using Git, run unit tests, and then, if tests pass, use Git commands (git tag and git push --tags) to create and push the tag back to the CodeCommit repository. This leverages standard Git functionality for repository operations. Using AWS CLI commands to create a Git tag (options B, C, D) is incorrect because the AWS CLI does not directly support creating Git tags within a CodeCommit repository. While the AWS CLI can interact with CodeCommit for repository management, Git tagging is a core Git protocol operation best handled by Git itself. Copying code via AWS CLI (option D) is also not the standard way to interact with a Git repository for building and testing.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed