Error in CDK 1.14.0: "Only a PipelineProject can be added to a CodePipeline"
See original GitHub issueI tried updating our CDK stacks to latest version but encountered a new problem with CodePipeline:
cdk/node_modules/@aws-cdk/aws-codebuild/lib/project.ts:766
throw new Error('Only a PipelineProject can be added to a CodePipeline');
^
Error: Only a PipelineProject can be added to a CodePipeline
at Project.bindToCodePipeline (cdk/node_modules/@aws-cdk/aws-codebuild/lib/project.ts:766:13)
at CodeBuildAction.bound (cdk/node_modules/@aws-cdk/aws-codepipeline-actions/lib/codebuild/build-action.ts:117:26)
at CodeBuildAction.bind (cdk/node_modules/@aws-cdk/aws-codepipeline-actions/lib/action.ts:30:17)
at Pipeline._attachActionToPipeline (cdk/node_modules/@aws-cdk/aws-codepipeline/lib/pipeline.ts:346:37)
at Stage.attachActionToPipeline (cdk/node_modules/@aws-cdk/aws-codepipeline/lib/stage.ts:136:27)
at Stage.addAction (cdk/node_modules/@aws-cdk/aws-codepipeline/lib/stage.ts:86:29)
at new Stage (cdk/node_modules/@aws-cdk/aws-codepipeline/lib/stage.ts:38:12)
at Pipeline.addStage (cdk/node_modules/@aws-cdk/aws-codepipeline/lib/pipeline.ts:298:19)
at Object.exports.addSourceAndBuildStages (cdk/pipeline-master.ts:117:12)
at Object.exports.createBuildOnlyPipeline (cdk/pipeline-build-only.ts:27:25)
Is there something we need to change now with the latest version?
Reproduction Steps
export const addSourceAndBuildStages = (
pipeline: codepipeline.Pipeline,
repository: codecommit.IRepository,
project: codebuild.Project) => {
const source = new codepipeline.Artifact('Source');
pipeline.addStage({
stageName: 'Source',
actions: [
new codepipeline_actions.CodeCommitSourceAction({
actionName: 'Source',
repository,
output: source,
role: codeCommitRole(pipeline.stack),
}),
]
});
const buildOutput = new codepipeline.Artifact();
// The problem is caused when adding following stage:
pipeline.addStage({
stageName: 'Build',
actions: [
new codepipeline_actions.CodeBuildAction({
actionName: 'Build',
input: source,
project,
outputs: [buildOutput],
}),
]
});
return buildOutput;
}
Environment
- CLI Version : 1.14.0
- Framework Version: 1.14.0
- OS : Macbook
- Language : TypeScript
Other
This is 🐛 Bug Report
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (8 by maintainers)
Top Results From Across the Web
class PipelineProject (construct) · AWS CDK
A callback invoked when the given project is added to a CodePipeline. enableBatchBuilds(), Enable batch builds. metric(metricName, props?) metricBuilds(props?)
Read more >aws-cdk.aws-codepipeline-actions - PyPI
This package contains Actions that can be used in a CodePipeline. import aws_cdk.aws_codepipeline as codepipeline import aws_cdk.aws_codepipeline_actions as ...
Read more >@aws-cdk/aws-codepipeline-actions | Yarn - Package Manager
This package contains Actions that can be used in a CodePipeline. import * as codepipeline from '@aws-cdk/aws-codepipeline'; ...
Read more >Amazon.CDK.AWS.CodePipeline 1.184.1 - NuGet
Version Downloads Last updated
1.184.1 0 31 minutes ago
1.184.0 46 2 days ago
1.183.0 256 9 days ago
Read more >TUTORIAL: Serverless CI/CD Security with AWS ... - LinkedIn
In this tutorial, we will be using AWS CodePipeline to deploy a serverless application and add Cloudguard Workload as a step in the...
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 see. For us this is a breaking change and require us to update our stacks and pipelines. We previously used just
Project
which worked fine for our use.The nasty thing is that when updating all pipelines, we again hit the #4465 and need to manually deploy all pipelines one-by-one to avoid hitting the resource limit.
When we quite mechanically converted our pipelines to CDK, we weren’t aware of differences between
PipelineProject
andProject
. TBH it still is not quite clear to me and the documentation does not help: “A representation of a CodeBuild Project” vs. “A convenience class for CodeBuild Projects that are used in CodePipeline.”.The versioning scheme is not problematic for us, and neither is minor change in code but since #4465 this became quite much work for not a clear reason. If you need customers to move to the proper construct, would it be possible to add a some kind of warning first before enforcing build-breaking change?