Skip to content

pipelines: Missing props unused check for CodePipeline #20334

@simonkarman

Description

@simonkarman

Describe the bug

In the constructor of pipelines.CodePipeline checks are done to verify that pipelineName and crossAccountKeys are not set if a pipeline is already provided through the props. However this check is missing for the reuseCrossRegionSupportStacks property.

Expected Behavior

Providing both the reuseCrossRegionSupportStacks parameter and the codePipeline parameter to a pipelines.CodePipeline should fail.

Current Behavior

However, right now: Providing both the reuseCrossRegionSupportStacks parameter and the codePipeline parameter to a pipelines.CodePipeline does not fail, although it should.

Reproduction Steps

The following should fail.

    import { aws_codepipeline as cp, pipelines } from 'aws-cdk-lib';
    new pipelines.CodePipeline(scope, 'CodePipeline', {
      reuseCrossRegionSupportStacks: true,
      codePipeline: new cp.Pipeline(scope, 'Pipeline'),
      synth: new pipelines.ShellStep('Synth', { commands: ['ls'] }),
    });

Possible Solution

Add the following piece of code to line 357 of the CodePipeline.

      if (this.props.reuseCrossRegionSupportStacks !== undefined) {
        throw new Error('Cannot set \'reuseCrossRegionSupportStacks\' if an existing CodePipeline is given using \'codePipeline\'');
      }

Additional Information/Context

No response

CDK CLI Version

2.16.0 (build 4c77925)

Framework Version

No response

Node.js Version

v14.18.0

OS

MacOS

Language

Typescript

Language Version

3.9.7

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/pipelinesCDK Pipelines librarybugThis issue is a bug.effort/smallSmall work item – less than a day of effortp2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions