aws / aws/aws-cdk

[pipelines] generate CodeBuild reports within @aws-cdk/cdk-pipelines

Open
#10,464 9 comments 21 reactions 0 assignees View on GitHub
@aws-cdk/pipelines effort/medium feature-request p1
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Description
To be able to easily use @aws-cdk/assert within @aws-cdk/cdk-pipelines. and use the reports function of CodeBuild.

### Use Case
Running tests on CDK using @aws-cdk/assert to increase the ability to Fail Fast and implement TDD.

### Proposed Solution

I have considered 2 options so far: ( there may be other options, and there may well be some other/better way to do this )

#####

**Option1:** add a testAction that adds another stage to codepipeline using another codebuild project :
```
const pipeline = new CdkPipeline(this, 'Pipeline', {
pipelineName: 'PipelineWithTests',
sourceAction: ...
synthAction: ...
testAction: simpleTestAction(...)
});
```
Where the new testAction includes support for **reports** in the buildSpec.

**Option2:** Enable adding **reports** to the existing SimpleSynthAction(and npm yarn variants) buildSpec:
adding the needed changes to the build step commands "yarn build && yarn test".
and adding along the lines of the bellow to the build spec perhaps with a testEnable Flag in the SynthAction.
```
reports:
jest_reports:
files:
-
file-format: JUNITXML
base-directory:
```

### Other

I understand that this can be done by creating a codeBuild on its own and adding to the pipeline, but that breaks the elegance and simplicity of using cdk-pipelines which dose a great job at simplifying the codepipeline/buid experience.

I would expect that jest tests would be ran by yarn or npm as described in the @aws-cdk/assert docs.
Reference: [test-report-jest](https://docs.aws.amazon.com/codebuild/latest/userguide/test-report-jest.html)

---

This is a :rocket: Feature Request

Contributor guide

Open the contributing guide

Research direction

Start by reading @aws-cdk/cdk-pipelines and the SimpleSynthAction, including its npm and yarn variants, then review the linked CodeBuild Jest test-report guidance. Compare the proposed separate testAction with adding reports to the existing synth action. Done means the chosen approach supports CodeBuild JUnitXML reports for the intended tests without requiring a separate CodeBuild project.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
ci-cd, cloud, devops
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.