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
- A. Modify the build stage. Add a test action that has a runOrder value of 1. Use AWS CodeDeploy as the action provider to run unit tests.
- B. Modify the build stage. Add a test action that has a runOrder value of 2. Use AWS CodeBuild as the action provider to run unit tests.
- C. Modify the deploy stage. Add a test action that has a runOrder value of 1. Use AWS CodeDeploy as the action provider to run unit tests.
- D. Modify the deploy stage. Add a test action that has a runOrder value of 2. Use AWS CodeBuild as the action provider to run unit tests.
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.