exam questions

Exam AWS Certified DevOps Engineer - Professional DOP-C02 All Questions

View all questions & answers for the AWS Certified DevOps Engineer - Professional DOP-C02 exam

Exam AWS Certified DevOps Engineer - Professional DOP-C02 topic 1 question 54 discussion

A development team uses AWS CodeCommit for version control for applications. The development team uses AWS CodePipeline, AWS CodeBuild. and AWS CodeDeploy for CI/CD infrastructure. In CodeCommit, the development team recently merged pull requests that did not pass long-running tests in the code base. The development team needed to perform rollbacks to branches in the codebase, resulting in lost time and wasted effort.
A DevOps engineer must automate testing of pull requests in CodeCommit to ensure that reviewers more easily see the results of automated tests as part of the pull request review.
What should the DevOps engineer do to meet this requirement?

  • 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.
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
MarDog
Highly Voted 1 year, 7 months ago
C. Look at #3 in the below. https://container-devsecops.awssecworkshops.com/04-testing/
upvoted 16 times
Gomer
8 months ago
Link is dead
upvoted 1 times
...
...
madperro
Highly Voted 1 year, 7 months ago
Selected Answer: B
B, we need to run tests only when pull request is created and we need to publish test results, not only badge.
upvoted 11 times
...
lgallard
Most Recent 2 weeks, 5 days ago
Selected Answer: C
C covers both event scenarios: PR creation and update (when updating the source branch, for example, with a new commit.
upvoted 1 times
...
Gomer
8 months ago
Selected Answer: C
"Automated Code Review on Pull Requests using AWS CodeCommit and AWS CodeBuild" "The solution comprises of the following components:" "Amazon EventBridge: AWS service to receive pullRequestCreated and pullRequestSourceBranchUpdated events and trigger Amazon EventBridge rule." https://aws.amazon.com/blogs/devops/automated-code-review-on-pull-requests-using-aws-codecommit-and-aws-codebuild/
upvoted 3 times
...
seetpt
9 months, 1 week ago
Selected Answer: C
i go with C
upvoted 1 times
...
zijo
10 months, 3 weeks ago
C is the answer to ensure code reviewers more easily see the results of automated tests as part of the pull request review pullRequestStatusChanged event is triggered whenever the status of a pull request changes. This could include transitions like: Open to Closed (pull request is merged or marked as closed) Closed to Open (pull request is reopened) pullRequestCreated event is triggered whenever a new pull request is created in a CodeCommit repository. pullRequestSourceBranchUpdated event is triggered whenever there are updates (new commits) pushed to the source branch of an open pull request
upvoted 4 times
shammous
6 months, 1 week ago
I agree the C is the closed correct answer but it doesn't mention pullRequestStatusChanged (not sure why you mention it in your comment). "The primary events in AWS CodeCommit that can trigger the pipeline are: - pullRequestCreated: This event occurs when a new pull request is created. - pullRequestSourceBranchUpdated: This event occurs when the source branch of an existing pull request is updated (e.g. when new commits are pushed to the branch)." The other events that might be considered but I would exclude are: - pullRequestStatusChanged: This event occurs when the status of a pull request changes, from closed to open (which we can consider), or from open to close (which we shouldn't consider in our case). - pullRequestMerged: This event occurs when a pull request is merged. I would exclude it because we are looking to test before merging.
upvoted 1 times
...
...
thanhnv142
1 year ago
B is correct: we need to react when there is merge request (pullRequestCreated event) A: we need to react when there is merge request, not when the status of merge request is changed (pullRequestStatusChanged event) C: we only need to react when there is merge request, not when a sourcebranch is updated (pullRequestSourceBranchUpdated events) D: we need to react when there is merge request, not when the status of merge request is changed (pullRequestStatusChanged event)
upvoted 2 times
gg_robin
7 months ago
If the source is updated after the PR is created, you don't run any tests against those changes.
upvoted 4 times
...
...
DucSiu
1 year, 1 month ago
Why not B?
upvoted 2 times
...
zolthar_z
1 year, 2 months ago
Answer is C: the pullRequestStatusChanged only has two values (OPEN|CLOSED) so If there is any update in the code the tests will not run. https://docs.aws.amazon.com/codecommit/latest/APIReference/API_PullRequestStatusChangedEventMetadata.html
upvoted 2 times
...
DZ_Ben
1 year, 3 months ago
Selected Answer: C
I'll go for C. Tbh, I don't think we will need a lambda here as the event rule can definitely trigger the code pipeline & code build.
upvoted 2 times
...
RVivek
1 year, 4 months ago
Selected Answer: C
https://aws.amazon.com/blogs/devops/automated-code-review-on-pull-requests-using-aws-codecommit-and-aws-codebuild/
upvoted 4 times
...
ggrodskiy
1 year, 5 months ago
Correct C.
upvoted 2 times
...
vherman
1 year, 6 months ago
Selected Answer: C
С run tests on pull requests created and when source branch receives new commits to re-run tests
upvoted 2 times
...
lunt
1 year, 6 months ago
Selected Answer: C
Not sure why so much discussion. Triggers Rule: A CloudWatch Event Rule is triggered based on the following events: pullRequestSourceBranchUpdated or pullRequestCreated. C is only viable option. I mean it even tells you the answer in the question "development team needed to perform rollbacks to branches in the codebase". Ans is C.
upvoted 2 times
...
tartarus23
1 year, 7 months ago
Selected Answer: C
This approach allows testing whenever a pull request is created or the source branch of a pull request is updated. When the tests are complete, the AWS Lambda function posts the test status badge as a comment on the pull request, providing visual feedback to reviewers directly in the context of the pull request review. It's important to note that CodeBuild creates a build badge that provides status about the last build, which might not directly reflect the test results of the specific pull request. Posting the test results would provide more accurate and relevant information but doing so might require additional scripting or tooling not described in the available options.
upvoted 3 times
...
bcx
1 year, 8 months ago
Selected Answer: C
C is the correct IMHO. A pull request is just a branch that the requestor is asking to be merged in master/main. When you create a pull request you set the branch, that is the start, you have to use the current contents of the branch to execute the tests. When time passes developers add commits to that branch or force-push it, changing the contents of the PR's branch. That is the moment in which you have to trigger the tests. The PR comments and discussions may change, but that does not change the code so no need to perform new tests. You only test when the PR is created and every time the branch is pushed (updated).
upvoted 3 times
...
youonebe
1 year, 8 months ago
Why not B?
upvoted 2 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago