DVA-C02 Question 229
Select 3You are developing a serverless application using AWS Lambda and API Gateway. Your team uses Git for version control and follows a feature branch workflow. During a code review, a team member suggests implementing a strategy to ensure that only tested and approved code is deployed to production using AWS CodePipeline. Which of the following steps should you include in your pipeline to ensure this requirement is met?
- A
Integrate the repository's main branch as the source stage in the pipeline.
- B
Configure a manual approval action after the build stage to review changes before deployment.
- C
Use a script in the build stage to automatically push untested code to the production branch.
- D
Add a test stage to the pipeline that runs automated tests on the code from feature branches.
- E
Configure the pipeline to deploy directly from the feature branch to the production environment.
Show answer and explanation
Correct answers: A, B, D
Explanation
To ensure only tested and approved code is deployed to production, the pipeline should use the main branch as the source, include automated testing, and implement a manual approval action. This combination ensures code stability, proper validation, and adherence to best practices.
- A. Correct.
Correct: The main branch typically contains tested and approved code. Using it as the source ensures only stable code enters the pipeline.
- B. Correct.
Correct: A manual approval action ensures that changes are reviewed by a team member before they are deployed, adding an additional layer of validation.
- C. Incorrect.
Incorrect: Pushing untested code directly to the production branch goes against best practices and can introduce instability.
- D. Correct.
Correct: Adding a test stage ensures that automated tests are run on code before it is deployed, increasing reliability.
- E. Incorrect.
Incorrect: Deploying directly from feature branches bypasses testing and approval stages, which can lead to unstable deployments.