Reputation: 97
I am trying to implement an AWS Code-Pipeline using aws-cdk v2. Here is my code which does not have any errors but errors out while doing a cdk synth.
const pipeline = new CodePipeline(this, "MyPipeline", {
pipelineName: "my-pipeline",
synth: new CodeBuildStep("SynthStep", {
input: CodePipelineSource.codeCommit(repo, "mainline"),
buildEnvironment: {
computeType: CodeBuild.ComputeType.MEDIUM,
buildImage: CodeBuild.LinuxBuildImage.STANDARD_5_0,
},
partialBuildSpec: buildSpec,
commands: [],
role: codeBuildSynthRole,
}),
crossAccountKeys: true,
selfMutation: true,
dockerEnabledForSelfMutation: true,
});
I get an error - 'Only one build spec is allowed to specify artifacts.' What am i doing wrong?
Upvotes: 0
Views: 1278
Reputation: 2226
You did not show your buildSpec
but I suspect it includes artifacts. CodeBuildStep
creates its own artifacts
element. If you view the CDK source by control-clicking in your IDE on the partialBuildSpec
, it says:
/**
* Additional configuration that can only be configured via BuildSpec
*
* You should not use this to specify output artifacts; those
* should be supplied via the other properties of this class, otherwise
* CDK Pipelines won't be able to inspect the artifacts.
*
* Set the `commands` to an empty array if you want to fully specify
* the BuildSpec using this field.
*/
Upvotes: 1