Skip to content

Commit

Permalink
feat(codepipeline): pipeline type v2 with pipeline-level variables an…
Browse files Browse the repository at this point in the history
…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*
  • Loading branch information
go-to-k authored Feb 13, 2024
1 parent 9419f54 commit 40ffe2b
Show file tree
Hide file tree
Showing 31 changed files with 73,336 additions and 15 deletions.

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 40ffe2b

Please sign in to comment.