A CI/CD setup uses CodePipeline and CodeBuild. The CodeBuild project runs tests and produces a test report. The company must retain these test reports for 90 days. Which approach satisfies this retention requirement?
Choose an answer
Tap an option to check your answer.
Correct answer: Define a report group in the CodeBuild buildspec with the proper path and format. Create an S3 bucket. Use an EventBridge rule that triggers a Lambda function to copy the reports to the S3 bucket after each build completes, and configure an S3 lifecycle rule to expire objects after 90 days..
Why this is the answer
The correct approach leverages CodeBuild's native reporting capabilities and AWS services for storage and retention. Defining a report group in the buildspec.yml allows CodeBuild to process and store test reports. An EventBridge rule can then detect when a CodeBuild project completes and trigger a Lambda function to copy these reports from CodeBuild's default storage (which is not directly configurable for retention) to a dedicated S3 bucket. An S3 lifecycle policy on this bucket ensures the reports are automatically expired after 90 days, meeting the retention requirement. Incorrect options: Storing reports directly via an S3 deploy action in CodePipeline is not the standard or most efficient way to handle CodeBuild test reports, which are designed to be managed by CodeBuild's reporting features. While CodePipeline has test actions, they are for integrating external testing tools, not for setting CodeBuild report expiration. CodeBuild's buildspec does not directly support setting report expiration. CodeBuild artifacts are for build outputs, not specifically for test reports with built-in retention policies. While you can store reports as artifacts, the direct S3 artifact destination doesn't integrate with CodeBuild's reporting features for proper report management and direct S3 lifecycle management for reports isn't the intended flow.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed