Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(codepipeline): Pipeline should allow pipelineType and variables passthrough to underlying CfnPipeline construct #28476

Closed
2 tasks
paihu opened this issue Dec 23, 2023 · 1 comment · Fixed by #28538
Labels
@aws-cdk/aws-codepipeline Related to AWS CodePipeline effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2

Comments

@paihu
Copy link

paihu commented Dec 23, 2023

Describe the feature

some case pipelineType "V2" is more cost effective.

I want to use Pipeline-level variables for manual trigger pipeline.

https://docs.aws.amazon.com/codepipeline/latest/userguide/pipeline-types-planning.html

https://aws.amazon.com/codepipeline/pricing/

Use Case

We have large Infrastructure. We want partial deploy.

use Manual trigger with Pipeline level variables and set deploy target through variables.

Proposed Solution

add pipelineType and variables to pipelineProps,

pipeline validate variables should set pipelineType "V2"

passthrough these to CfnPipeline

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

CDK version used

2.116.1

Environment details (OS name and version, etc.)

windows 11

@paihu paihu added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Dec 23, 2023
@github-actions github-actions bot added the @aws-cdk/aws-codepipeline Related to AWS CodePipeline label Dec 23, 2023
@pahud pahud added p2 effort/medium Medium work item – several days of effort and removed needs-triage This issue or PR still needs to be triaged. labels Dec 24, 2023
@mergify mergify bot closed this as completed in #28538 Feb 13, 2024
mergify bot pushed a commit that referenced this issue Feb 13, 2024
…d triggers (#28538)

This PR supports pipeline type v2 with pipeline-level variables and triggers.

When referring to a variable in pipeline actions, it must be specified according to the format `#{variables.variableName}`. In order to avoid the need to specify directly in this form, a new class `Variable` with a `reference()` method was created.

```ts
const myVariable = new codepipeline.Variable({
  variableName: 'bucket-var',
  description: 'description',
  defaultValue: 'sample',
});

const pipeline = new codepipeline.Pipeline(stack, 'Pipeline', {
  artifactBucket: sourceBucket,
  pipelineType: codepipeline.PipelineType.V2,
  variables: [myVariable],
  stages: [
    {
      stageName: 'Source',
      actions: [sourceAction],
    },
    {
      stageName: 'Deploy',
      actions: [
        new S3DeployAction({
          actionName: 'DeployAction',
          extract: false,
          // objectKey: '#{variables.bucket-var}.txt',
          objectKey: `${myVariable.reference()}.txt`,
          input: sourceOutput,
          bucket: deployBucket,
        }),
      ],
    },
  ],
});
```

- user guide
  - https://docs.aws.amazon.com/codepipeline/latest/userguide/pipeline-types-planning.html
  - https://docs.aws.amazon.com/codepipeline/latest/userguide/reference-variables.html#reference-variables-workflow
  - https://docs.aws.amazon.com/codepipeline/latest/userguide/tutorials-github-tags.html
- CloudFormation
  - https://docs.aws.amazon.com/ja_jp/AWSCloudFormation/latest/UserGuide/aws-resource-codepipeline-pipeline.html
  - https://docs.aws.amazon.com/ja_jp/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-variabledeclaration.html
  - https://docs.aws.amazon.com/ja_jp/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-pipelinetriggerdeclaration.html

Closes #28476 #28694.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

GavinZZ pushed a commit that referenced this issue Feb 22, 2024
…d triggers (#28538)

This PR supports pipeline type v2 with pipeline-level variables and triggers.

When referring to a variable in pipeline actions, it must be specified according to the format `#{variables.variableName}`. In order to avoid the need to specify directly in this form, a new class `Variable` with a `reference()` method was created.

```ts
const myVariable = new codepipeline.Variable({
  variableName: 'bucket-var',
  description: 'description',
  defaultValue: 'sample',
});

const pipeline = new codepipeline.Pipeline(stack, 'Pipeline', {
  artifactBucket: sourceBucket,
  pipelineType: codepipeline.PipelineType.V2,
  variables: [myVariable],
  stages: [
    {
      stageName: 'Source',
      actions: [sourceAction],
    },
    {
      stageName: 'Deploy',
      actions: [
        new S3DeployAction({
          actionName: 'DeployAction',
          extract: false,
          // objectKey: '#{variables.bucket-var}.txt',
          objectKey: `${myVariable.reference()}.txt`,
          input: sourceOutput,
          bucket: deployBucket,
        }),
      ],
    },
  ],
});
```

- user guide
  - https://docs.aws.amazon.com/codepipeline/latest/userguide/pipeline-types-planning.html
  - https://docs.aws.amazon.com/codepipeline/latest/userguide/reference-variables.html#reference-variables-workflow
  - https://docs.aws.amazon.com/codepipeline/latest/userguide/tutorials-github-tags.html
- CloudFormation
  - https://docs.aws.amazon.com/ja_jp/AWSCloudFormation/latest/UserGuide/aws-resource-codepipeline-pipeline.html
  - https://docs.aws.amazon.com/ja_jp/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-variabledeclaration.html
  - https://docs.aws.amazon.com/ja_jp/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-pipelinetriggerdeclaration.html

Closes #28476 #28694.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-codepipeline Related to AWS CodePipeline effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2
Projects
None yet
2 participants