Skip to content

Commit ae8df08

Browse files
committed
feat(codepipeline): add pipeline type props
1 parent 5f96d13 commit ae8df08

3 files changed

Lines changed: 38 additions & 1 deletion

File tree

packages/aws-cdk-lib/aws-codepipeline/lib/pipeline.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,13 @@ export interface PipelineProps {
173173
* @default - true (Use the same support stack for all pipelines in App)
174174
*/
175175
readonly reuseCrossRegionSupportStacks?: boolean;
176+
177+
/**
178+
* Name of the pipeline.
179+
*
180+
* @default - AWS CloudFormation default.
181+
*/
182+
readonly pipelineType?: string;
176183
}
177184

178185
abstract class PipelineBase extends Resource implements IPipeline {
@@ -442,6 +449,7 @@ export class Pipeline extends PipelineBase {
442449
roleArn: this.role.roleArn,
443450
restartExecutionOnUpdate: props && props.restartExecutionOnUpdate,
444451
name: this.physicalName,
452+
pipelineType: props.pipelineType,
445453
});
446454

447455
// this will produce a DependsOn for both the role and the policy resources.

packages/aws-cdk-lib/aws-codepipeline/test/pipeline.test.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,35 @@ import * as codepipeline from '../lib';
1313

1414
describe('', () => {
1515
describe('Pipeline', () => {
16+
test('can be passed PipelineType during pipeline creation', () => {
17+
const stack = new cdk.Stack();
18+
const pipeline = new codepipeline.Pipeline(stack, 'Pipeline', {
19+
pipelineType: 'V1',
20+
});
21+
22+
// Adding 2 stages with actions so pipeline validation will pass
23+
const sourceArtifact = new codepipeline.Artifact();
24+
pipeline.addStage({
25+
stageName: 'Source',
26+
actions: [new FakeSourceAction({
27+
actionName: 'FakeSource',
28+
output: sourceArtifact,
29+
})],
30+
});
31+
32+
pipeline.addStage({
33+
stageName: 'Build',
34+
actions: [new FakeBuildAction({
35+
actionName: 'FakeBuild',
36+
input: sourceArtifact,
37+
})],
38+
});
39+
40+
Template.fromStack(stack).hasResourceProperties('AWS::CodePipeline::Pipeline', {
41+
'PipelineType': 'V1',
42+
});
43+
});
44+
1645
test('can be passed an IAM role during pipeline creation', () => {
1746
const stack = new cdk.Stack();
1847
const role = new iam.Role(stack, 'Role', {

packages/aws-cdk-lib/jest.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module.exports = {
66

77
// Different than usual
88
testMatch: [
9-
'<rootDir>/**/test/**/?(*.)+(test).ts',
9+
'<rootDir>/**/aws-codepipeline/test/**/?(*.)+(test).ts',
1010
],
1111

1212
coverageThreshold: {

0 commit comments

Comments
 (0)