AWS Certified DevOps Engineer – Professional (DOP-C02) — Question 165

A software team is using AWS CodePipeline to automate its Java application release pipeline. The pipeline consists of a source stage, then a build stage, and then a deploy stage. Each stage contains a single action that has a runOrder value of 1.

The team wants to integrate unit tests into the existing release pipeline. The team needs a solution that deploys only the code changes that pass all unit tests.

Which solution will meet these requirements?

Answer options

Correct answer: B

Explanation

The correct answer is B because adding a test action with a runOrder value of 2 in the build stage allows the unit tests to run after the build process, ensuring that only code changes that pass the tests are deployed. Options A and C incorrectly place the test action in the build or deploy stages with a runOrder of 1, which would not allow for proper sequencing. Option D also places the test action in the deploy stage, which is not suitable for running unit tests before deployment.