AmazonAmazon DevOps Engineer Professional DOP-C02 Certification·EN·Updated 4 Aug 2026
A team uses AWS CodeCommit, CodePipeline, CodeBuild, and CodeDeploy. Pull requests that failed long-running tests were merged, causing rollbacks and wasted effort. The team wants automated tests for pull requests and clear test results visible during pull-request review. What should the DevOps engineer implement?
Choose an answer
Tap an option to check your answer.
Correct 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..
Why this is the answer
The correct solution addresses the need for automated testing on pull requests and visibility of test results. Reacting to pullRequestCreated ensures tests run when a PR is initially opened, while pullRequestSourceBranchUpdated triggers tests when new commits are pushed to the source branch, covering all changes. An AWS Lambda function is a suitable orchestrator to invoke a CodePipeline, which uses CodeBuild to run the tests. Posting a CodeBuild badge as a comment directly on the pull request provides immediate, clear visual feedback to developers during their review process, fulfilling the requirement for visible test results.
Incorrect options:
Reacting only to pullRequestStatusChanged is insufficient as it might miss initial PR creation or subsequent updates to the source branch.
Posting full test results as a comment can be verbose and less immediate than a badge. Badges offer a concise, at-a-glance status.