Which solution will meet these requirements?
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.
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.
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.
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.
Explanations:
Adding a test action to the build stage with a runOrder value of 1 would conflict with the existing build action (also with runOrder 1). Actions in a stage must have unique runOrder values, and AWS CodeDeploy is primarily used for deploying applications, not for running unit tests.
Modifying the build stage to include a test action with a runOrder value of 2 ensures that the test action runs after the build action, allowing unit tests to be executed on the built artifacts. Using AWS CodeBuild as the action provider is appropriate for running unit tests as it is designed for build and test tasks. If the tests fail, the pipeline will not proceed to the deploy stage, thus meeting the requirement to deploy only code that passes all unit tests.
Adding a test action to the deploy stage with a runOrder value of 1 would conflict with the existing deploy action (also with runOrder 1). Moreover, running unit tests during the deploy stage is not a typical practice; tests should generally be run in the build stage to validate code before deployment.
Modifying the deploy stage to include a test action with a runOrder value of 2 does not make sense since the deploy action should occur only after all tests have passed. Additionally, unit tests should not be run in the deploy stage; they should be executed earlier in the pipeline (preferably in the build stage) to ensure code integrity before deployment.