简体   繁体   English

使用 CodeBuildStep 的代码管道的 AWS CDK 合成器错误

[英]AWS CDK synth errors out for a Code Pipeline with CodeBuildStep

I am trying to implement an AWS Code-Pipeline using aws-cdk v2.我正在尝试使用 aws-cdk v2 实现 AWS 代码管道。 Here is my code which does not have any errors but errors out while doing a cdk synth.这是我的代码,没有任何错误,但在执行 cdk 合成器时出错。

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?我究竟做错了什么?

You did not show your buildSpec but I suspect it includes artifacts.您没有显示您的buildSpec ,但我怀疑它包含工件。 CodeBuildStep creates its own artifacts element. CodeBuildStep创建自己的artifacts元素。 If you view the CDK source by control-clicking in your IDE on the partialBuildSpec , it says:如果您通过在 partialBuildSpec 上的partialBuildSpec中按住 control 并单击来查看 CDK 源代码,它会显示:

    /**
     * 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.
     */

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 aws cdk 入门 - `cdk synth` 命令的“空”output - Getting started with aws cdk - "empty" output of `cdk synth` command python CDK 中的 AWS 网关负载均衡器合成失败 - Synth of AWS gateway load balancer in python CDK is failing AWS CDK 代码管道开发 - Typescript 错误 TS2307 - AWS CDK Code Pipeline Development - Typescript Error TS2307 AWS CDK 代码管道开发 - 错误 TS1005:预期为“]” - AWS CDK Code Pipeline Development - error TS1005: ']' expected AWS CDK 在 Synth 项目中找不到 Custom.d.ts 文件 - AWS CDK Not Finding Custom .d.ts files in project on Synth 如何将 output AWS CDK 合成到终端/网络浏览器 [如果可能] - How to output AWS CDK synth to terminal/web browser [if possible] 通过 AWS 上的 CDK 管道构建代码时,我可以在 Github 上标记我的代码吗? - Can I tag my code on Github when building it through a CDK Pipeline on AWS? 在 CDK ShellStep(管道)步骤中使用 AWS CLI - Use the AWS CLI in a CDK ShellStep (pipeline) step AWS CDK 代码管道开发——NodejsFunction Package.json 依赖项如何安装? - AWS CDK Code Pipeline Development - How Do I Install NodejsFunction Package.json Dependencies? 如何指定目录来触发代码管道cdk? - How to Specify directory to trigger code pipeline cdk?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM