(pipeline): primaryOutputDirectory doesn't work
See original GitHub issueWhat is the problem?
I coded just as mentioned about primaryOutputDirectory, but it fails to work. This is my code snippet.
// The basic pipeline declaration. This sets the initial structure
// of our pipeline
const cdk_infra_path = "packages/cdk-infra";
const cdk_infra_path_back = "../..";
const cdk_out_path = "cdk.out";
const steps = new pipelines.ShellStep("Synth", {
input: pipelines.CodePipelineSource.codeCommit(repo, "master"),
commands: [
"cd " + cdk_infra_path,
"npx lerna bootstrap --ci",
"npx lerna run build",
"npx cdk synth",
"cd " + cdk_infra_path_back,
"ln -s " + cdk_infra_path + "/" + cdk_out_path + " " + cdk_out_path,
],
primaryOutputDirectory: cdk_infra_path + "/" + cdk_out_path,
});
const pipeline = new pipelines.CodePipeline(this, "Pipeline", {
pipelineName: SrvConfig.PIPELINE_NAME,
synth: steps,
});
}
However, it fails me at the end with this CodeBuild log output.
< snip >
Source:
BuildSpec: |-
{
"version": "0.2",
"phases": {
"build": {
"commands": [
"cd packages/cdk-infra",
"npx lerna bootstrap --ci",
"npx lerna run build",
"npx cdk synth",
"cd ../..",
"ln -s packages/cdk-infra/cdk.out cdk.out"
]
}
},
"artifacts": {
"base-directory": "packages/cdk-infra/cdk.out", <=====
"files": "**/*"
}
}
Type: CODEPIPELINE
< snip >
[Container] 2022/01/06 18:37:12 Phase complete: BUILD State: SUCCEEDED
[Container] 2022/01/06 18:37:12 Phase context status code: Message:
[Container] 2022/01/06 18:37:12 Entering phase POST_BUILD
[Container] 2022/01/06 18:37:12 Phase complete: POST_BUILD State: SUCCEEDED
[Container] 2022/01/06 18:37:12 Phase context status code: Message:
[Container] 2022/01/06 18:37:12 Expanding base directory path: cdk.out <=====
[Container] 2022/01/06 18:37:12 Assembling file list
[Container] 2022/01/06 18:37:12 Expanding cdk.out
[Container] 2022/01/06 18:37:12 Skipping invalid file path cdk.out
[Container] 2022/01/06 18:37:12 Phase complete: UPLOAD_ARTIFACTS State: FAILED
[Container] 2022/01/06 18:37:12 Phase context status code: CLIENT_ERROR Message: no matching base directory path found for cdk.out
The whole log: log-events-viewer-result (1).csv
My two cents on this. Maybe this code (https://github.com/aws/aws-cdk/blob/master/packages/%40aws-cdk/pipelines/lib/main/pipeline-base.ts#L62) is reverting the path to cdk.out
?
Please help. I need my CDK v2 + CodePipeline working for my customer.
Reproduction Steps
- Enable CDK v2 + CodePipeline as mentioned in https://docs.aws.amazon.com/cdk/v2/guide/cdk_pipeline.html#cdk_pipeline_define
- Move the CDK folder to
packages/cdk-infra
- Keep it working with CDK v2 + CodePipeline but it will fail on CodeBuild stage.
What did you expect to happen?
CDK v2 + CodePipeline + primaryOutputDirectory
working in my CDK infra’s subdirectory of packages/cdk-infra
.
What actually happened?
Failed at CodeBuild with the log mentioned above.
CDK CLI Version
2.4.0 (build 993f14d)
Framework Version
2.4.0
Node.js Version
v14.17.5
OS
MacOS
Language
Typescript
Language Version
Version 4.1.3
Other information
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (1 by maintainers)
Top Results From Across the Web
primary output directory `root/cdk.out` generates errors since ...
What is the problem? We observe in the default cdk pipeline: Failed to load notices from cache: Error: ENOENT: no such file or...
Read more >Troubleshooting Cell Ranger -Software - Support
At the start of any cellranger pipeline, the software looks for its intended output directory. If such a directory exists, this directory/run is...
Read more >aws-cdk/pipelines module - AWS Documentation - Amazon.com
This module contains two sets of APIs: an original and a modern version of CDK Pipelines. The modern API has been updated to...
Read more >When I add this BucketDeployment to my CDK CodePipeline ...
TL;DR With two changes, the pipeline successfully deploys the React app: (1) Source.asset needs the full path to the build directory and (2) ......
Read more >Troubleshooting ML pipelines - Azure Machine Learning
output_dir, exist_ok=True) to create the output directory. See the tutorial for a scoring script example that shows this design pattern.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I can confirm it doesn’t work on 2.5.0. I had to run
cdk bootstrap
to fix the issue. Though it said there were no changes, it actually helped.Thank you, @makemefeelgr8 and @rix0rrr for your time. Case resolved.