(cdk pipelines): primary output directory `root/cdk.out` generates errors since notices release
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
### What is the problem?
We observe in the default cdk pipeline:
```
Failed to load notices from cache: Error: ENOENT: no such file or directory, open '/root/.cdk/cache/notices.json'
Error on request: Error: read ETIMEDOUT
Notices refreshed
Error on request: Error: read ETIMEDOUT
Failed to get tree.json file: Error: cdk.out/tree.json: ENOTDIR: not a directory, open 'cdk.out/tree.json'
```
Note, we have the `cdk root` of our project in /infrastructure folder. That is specified in code:
```js
primaryOutputDirectory: "infrastructure/cdk.out",
```
It does not result in error, just in a very long wait and then succesful exit.
### Reproduction Steps
```js
const pipeline = new pipelines.CodePipeline(
this,
"niceName",
{
pipelineName: "niceName",
crossAccountKeys: true,
synth: new pipelines.CodeBuildStep("SynthStep", {
input: remote,
commands: [
"cd infrastructure",
"npm ci",
"npm run test",
"npm run build",
"npx cdk synth",
],
primaryOutputDirectory: "infrastructure/cdk.out",
}),
codeBuildDefaults: {
vpc: <...>,
subnetSelection: { subnets: <...> },
partialBuildSpec: codebuild.BuildSpec.fromObject({
phases: {
install: {
"runtime-versions": {
nodejs: "14.x",
},
},
pre_build: {
commands: ["n 16"],
},
},
}),
rolePolicy: [
new iam.PolicyStatement({
actions: ["<...>:<...>"],
resources: ["<...>"],
}),
],
},
}
);
```
### What did you expect to happen?
Pipeline result:
```
Time taken 30s blahblah :D
```
### What actually happened?
```
Failed to load notices from cache: Error: ENOENT: no such file or directory, open '/root/.cdk/cache/notices.json'
Error on request: Error: read ETIMEDOUT
Notices refreshed
Error on request: Error: read ETIMEDOUT
Failed to get tree.json file: Error: cdk.out/tree.json: ENOTDIR: not a directory, open 'cdk.out/tree.json'
```
### CDK CLI Version
2.13.0
### Framework Version
_No response_
### Node.js Version
17
### OS
MacOs
### Language
Typescript
### Language Version
TS 4
### Other information
_No response_
Contributor guide
Research direction
Start with the CodePipeline and CodeBuildStep configuration shown in the issue, especially the `cd infrastructure` command and `primaryOutputDirectory: "infrastructure/cdk.out"`. Reproduce the synth using the listed commands and inspect how the output directory is resolved; done means the pipeline completes without the `cdk.out/tree.json` ENOTDIR error and without the excessive wait.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, node.js, typescript
- Domain
- cloud, devops, infrastructure
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100