
Answer-first summary for fast verification
Answer: Create an Amazon EventBridge rule that reacts to pullRequestCreated and pullRequestSourceBranchUpdated events. Create an AWS Lambda function that invokes a CodePipeline pipeline with a CodeBuild action that runs the tests for the application. Program the Lambda function to post the CodeBuild badge as a comment on the pull request so that developers will see the badge in their code review.
Option C is the correct answer. The reason is that it suggests creating an Amazon EventBridge rule that reacts to pullRequestCreated and pullRequestSourceBranchUpdated events. This ensures that tests are run whenever a pull request is created or updated. Additionally, this option involves posting a CodeBuild badge as a comment on the pull request, which helps developers see the results of the tests in their code review. The highly voted comments suggest that pullRequestStatusChanged event only has two values (OPEN|CLOSED), which may not trigger the tests on updates, making Option C the best choice.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
No comments yet.
A development team utilizes AWS CodeCommit for version control, AWS CodePipeline, AWS CodeBuild, and AWS CodeDeploy for their CI/CD infrastructure. Recently, they merged pull requests in CodeCommit without ensuring they passed long-running tests, leading to rollbacks and wasted effort. To prevent this in the future, a DevOps engineer needs to automate the testing of pull requests in CodeCommit so that reviewers can easily view the results of these automated tests during the review process. What solution should the DevOps engineer implement to achieve this?
A
Create an Amazon EventBridge rule that reacts to the pullRequestStatusChanged event. Create an AWS Lambda function that invokes a CodePipeline pipeline with a CodeBuild action that runs the tests for the application. Program the Lambda function to post the CodeBuild badge as a comment on the pull request so that developers will see the badge in their code review.
B
Create an Amazon EventBridge rule that reacts to the pullRequestCreated event. Create an AWS Lambda function that invokes a CodePipeline pipeline with a CodeBuild action that runs the tests for the application. Program the Lambda function to post the CodeBuild test results as a comment on the pull request when the test results are complete.
C
Create an Amazon EventBridge rule that reacts to pullRequestCreated and pullRequestSourceBranchUpdated events. Create an AWS Lambda function that invokes a CodePipeline pipeline with a CodeBuild action that runs the tests for the application. Program the Lambda function to post the CodeBuild badge as a comment on the pull request so that developers will see the badge in their code review.
D
Create an Amazon EventBridge rule that reacts to the pullRequestStatusChanged event. Create an AWS Lambda function that invokes a CodePipeline pipeline with a CodeBuild action that runs the tests for the application. Program the Lambda function to post the CodeBuild test results as a comment on the pull request when the test results are complete.