(pipeline): no matching base directory path found for cdk/cdk.out
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
### Describe the bug
I am using CDK with CodePipeline and CodeBuild, everything works fine in Linux aws/codebuild/standard:6.0.
However, when I upgrade to aws/codebuild/standard:7.0 or Amazon Linux 2 x86_64 standard image, version 5.0, **npx cdk synth** does nothing, as the result I got the following errors when synthesizing from pipeline.
```
42 | [Container] 2023/12/29 07:11:14.079166 Running command npx cdk synth
43 |
44 | [Container] 2023/12/29 07:11:16.641555 Phase complete: BUILD State: SUCCEEDED
45 | [Container] 2023/12/29 07:11:16.641572 Phase context status code: Message:
46 | [Container] 2023/12/29 07:11:16.683183 Entering phase POST_BUILD
47 | [Container] 2023/12/29 07:11:16.684920 Phase complete: POST_BUILD State: SUCCEEDED
48 | [Container] 2023/12/29 07:11:16.684933 Phase context status code: Message:
49 | [Container] 2023/12/29 07:11:16.770308 Expanding base directory path: cdk/cdk.out
50 | [Container] 2023/12/29 07:11:16.773789 Assembling file list
51 | [Container] 2023/12/29 07:11:16.773807 Expanding cdk/cdk.out
52 | [Container] 2023/12/29 07:11:16.776932 Skipping invalid file path cdk/cdk.out
53 | [Container] 2023/12/29 07:11:16.777023 Phase complete: UPLOAD_ARTIFACTS State: FAILED
54 | [Container] 2023/12/29 07:11:16.777033 Phase context status code: CLIENT_ERROR Message: no matching base directory path found for cdk/cdk.out
```
### Expected Behavior
cdk/cdk.out should be found
### Current Behavior
cdk/cdk.out is not found
### Reproduction Steps
```
export class CdkStack extends cdk.Stack {
constructor(scope: Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
const pipeline = new CodePipeline(this, 'Pipeline', {
pipelineName: 'Pipeline',
crossAccountKeys: true,
synth: new ShellStep('Synth', {
input: xxx,
commands: ['cd cdk', 'npm ci', 'npm run build', 'npx cdk synth'],
primaryOutputDirectory: 'cdk/cdk.out'
}),
codeBuildDefaults: {
buildEnvironment: {
buildImage: LinuxBuildImage.STANDARD_7_0
}
}
})
}
}
```
### Possible Solution
_No response_
### Additional Information/Context
_No response_
### CDK CLI Version
2.117.0 (build 59d9b23)
### Framework Version
_No response_
### Node.js Version
20.10.4
### OS
Linux
### Language
TypeScript
### Language Version
_No response_
### Other information
_No response_
Contributor guide
Research direction
Reproduce the pipeline using the shown ShellStep commands, LinuxBuildImage.STANDARD_7_0, and primaryOutputDirectory cdk/cdk.out, then compare it with aws/codebuild/standard:6.0. Start at the CDK Pipeline ShellStep and CodeBuild artifact-upload configuration; done means npx cdk synth produces cdk/cdk.out and the pipeline uploads it without the no matching base directory path error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, node.js, typescript
- Domain
- build-system, cloud, devops
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100