0

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?

1
  • 2
    The issue is not in the code you provided - it's either in the source step or the synth buildspec. Commented Mar 16, 2022 at 18:08

1 Answer 1

1

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.
     */
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.