diff --git a/packages/@aws-cdk/aws-codepipeline-actions/README.md b/packages/@aws-cdk/aws-codepipeline-actions/README.md index 905c1161b3ab4..592555a298216 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/README.md +++ b/packages/@aws-cdk/aws-codepipeline-actions/README.md @@ -65,7 +65,7 @@ const sourceAction = new codepipeline_actions.GitHubSourceAction({ oauthToken: token.value, output: sourceOutput, branch: 'develop', // default: 'master' - trigger: codepipeline_actions.GitHubTrigger.Poll // default: 'WebHook', 'None' is also possible for no Source trigger + trigger: codepipeline_actions.GitHubTrigger.POLL // default: 'WEBHOOK', 'NONE' is also possible for no Source trigger }); pipeline.addStage({ stageName: 'Source', @@ -99,8 +99,8 @@ pipeline.addStage({ ``` By default, the Pipeline will poll the Bucket to detect changes. -You can change that behavior to use CloudWatch Events by setting the `pollForSourceChanges` -property to `false` (it's `true` by default). +You can change that behavior to use CloudWatch Events by setting the `trigger` +property to `S3Trigger.EVENTS` (it's `S3Trigger.POLL` by default). If you do that, make sure the source Bucket is part of an AWS CloudTrail Trail - otherwise, the CloudWatch Events will not be emitted, and your Pipeline will not react to changes in the Bucket. @@ -119,7 +119,7 @@ const sourceAction = new codepipeline_actions.S3SourceAction({ bucketKey: key, bucket: sourceBucket, output: sourceOutput, - pollForSourceChanges: false, // default: true + trigger: codepipeline_actions.S3Trigger.EVENTS, // default: S3Trigger.POLL }); ``` diff --git a/packages/@aws-cdk/aws-codepipeline-actions/lib/cloudformation/pipeline-actions.ts b/packages/@aws-cdk/aws-codepipeline-actions/lib/cloudformation/pipeline-actions.ts index c26d8d1b77244..9721d5f8dd5ce 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/lib/cloudformation/pipeline-actions.ts +++ b/packages/@aws-cdk/aws-codepipeline-actions/lib/cloudformation/pipeline-actions.ts @@ -8,7 +8,7 @@ import { Stack } from '@aws-cdk/cdk'; /** * Properties common to all CloudFormation actions */ -export interface CloudFormationActionProps extends codepipeline.CommonActionProps { +interface CloudFormationActionProps extends codepipeline.CommonActionProps { /** * The name of the stack to apply this action to */ @@ -60,7 +60,7 @@ export interface CloudFormationActionProps extends codepipeline.CommonActionProp /** * Base class for Actions that execute CloudFormation */ -export abstract class CloudFormationAction extends codepipeline.Action { +abstract class CloudFormationAction extends codepipeline.Action { constructor(props: CloudFormationActionProps, configuration?: any) { super({ ...props, @@ -119,7 +119,7 @@ export class CloudFormationExecuteChangeSetAction extends CloudFormationAction { /** * Properties common to CloudFormation actions that stage deployments */ -export interface CloudFormationDeployActionProps extends CloudFormationActionProps { +interface CloudFormationDeployActionProps extends CloudFormationActionProps { /** * IAM role to assume when deploying changes. * @@ -216,7 +216,7 @@ export interface CloudFormationDeployActionProps extends CloudFormationActionPro /** * Base class for all CloudFormation actions that execute or stage deployments. */ -export abstract class CloudFormationDeployAction extends CloudFormationAction { +abstract class CloudFormationDeployAction extends CloudFormationAction { private _deploymentRole?: iam.IRole; private readonly props: CloudFormationDeployActionProps; diff --git a/packages/@aws-cdk/aws-codepipeline-actions/lib/codecommit/source-action.ts b/packages/@aws-cdk/aws-codepipeline-actions/lib/codecommit/source-action.ts index 8368ec9af90c8..e7ae52163284b 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/lib/codecommit/source-action.ts +++ b/packages/@aws-cdk/aws-codepipeline-actions/lib/codecommit/source-action.ts @@ -4,6 +4,29 @@ import targets = require('@aws-cdk/aws-events-targets'); import iam = require('@aws-cdk/aws-iam'); import { sourceArtifactBounds } from '../common'; +/** + * How should the CodeCommit Action detect changes. + * This is the type of the {@link CodeCommitSourceAction.trigger} property. + */ +export enum CodeCommitTrigger { + /** + * The Action will never detect changes - + * the Pipeline it's part of will only begin a run when explicitly started. + */ + NONE = 'None', + + /** + * CodePipeline will poll the repository to detect changes. + */ + POLL = 'Poll', + + /** + * CodePipeline will use CloudWatch Events to be notified of changes. + * This is the default method of detecting changes. + */ + EVENTS = 'Events', +} + /** * Construction properties of the {@link CodeCommitSourceAction CodeCommit source CodePipeline Action}. */ @@ -19,12 +42,11 @@ export interface CodeCommitSourceActionProps extends codepipeline.CommonActionPr readonly branch?: string; /** - * Whether AWS CodePipeline should poll for source changes. - * If this is `false`, the Pipeline will use CloudWatch Events to detect source changes instead. + * How should CodePipeline detect source changes for this Action. * - * @default false + * @default CodeCommitTrigger.EVENTS */ - readonly pollForSourceChanges?: boolean; + readonly trigger?: CodeCommitTrigger; /** * The CodeCommit repository. @@ -36,9 +58,13 @@ export interface CodeCommitSourceActionProps extends codepipeline.CommonActionPr * CodePipeline Source that is provided by an AWS CodeCommit repository. */ export class CodeCommitSourceAction extends codepipeline.Action { - private readonly props: CodeCommitSourceActionProps; + private readonly repository: codecommit.IRepository; + private readonly branch: string; + private readonly createEvent: boolean; constructor(props: CodeCommitSourceActionProps) { + const branch = props.branch || 'master'; + super({ ...props, category: codepipeline.ActionCategory.SOURCE, @@ -47,34 +73,35 @@ export class CodeCommitSourceAction extends codepipeline.Action { outputs: [props.output], configuration: { RepositoryName: props.repository.repositoryName, - BranchName: props.branch || 'master', - PollForSourceChanges: props.pollForSourceChanges || false, + BranchName: branch, + PollForSourceChanges: props.trigger === CodeCommitTrigger.POLL, }, }); - this.props = props; + this.repository = props.repository; + this.branch = branch; + this.createEvent = props.trigger === undefined || + props.trigger === CodeCommitTrigger.EVENTS; } protected bind(info: codepipeline.ActionBind): void { - if (!this.props.pollForSourceChanges) { - this.props.repository.onCommit(info.pipeline.node.uniqueId + 'EventRule', { + if (this.createEvent) { + this.repository.onCommit(info.pipeline.node.uniqueId + 'EventRule', { target: new targets.CodePipeline(info.pipeline), - branches: [this.props.branch || 'master'] + branches: [this.branch], }); } // https://docs.aws.amazon.com/codecommit/latest/userguide/auth-and-access-control-permissions-reference.html#aa-acp - const actions = [ - 'codecommit:GetBranch', - 'codecommit:GetCommit', - 'codecommit:UploadArchive', - 'codecommit:GetUploadArchiveStatus', - 'codecommit:CancelUploadArchive', - ]; - info.role.addToPolicy(new iam.PolicyStatement({ - resources: [this.props.repository.repositoryArn], - actions + resources: [this.repository.repositoryArn], + actions: [ + 'codecommit:GetBranch', + 'codecommit:GetCommit', + 'codecommit:UploadArchive', + 'codecommit:GetUploadArchiveStatus', + 'codecommit:CancelUploadArchive', + ], })); } } diff --git a/packages/@aws-cdk/aws-codepipeline-actions/lib/github/source-action.ts b/packages/@aws-cdk/aws-codepipeline-actions/lib/github/source-action.ts index 4c80a4f93c03e..559be30bb842a 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/lib/github/source-action.ts +++ b/packages/@aws-cdk/aws-codepipeline-actions/lib/github/source-action.ts @@ -50,11 +50,11 @@ export interface GitHubSourceActionProps extends codepipeline.CommonActionProps /** * How AWS CodePipeline should be triggered * - * With the default value "WebHook", a webhook is created in GitHub that triggers the action - * With "Poll", CodePipeline periodically checks the source for changes + * With the default value "WEBHOOK", a webhook is created in GitHub that triggers the action + * With "POLL", CodePipeline periodically checks the source for changes * With "None", the action is not triggered through changes in the source * - * @default GitHubTrigger.WebHook + * @default GitHubTrigger.WEBHOOK */ readonly trigger?: GitHubTrigger; } diff --git a/packages/@aws-cdk/aws-codepipeline-actions/lib/s3/source-action.ts b/packages/@aws-cdk/aws-codepipeline-actions/lib/s3/source-action.ts index 91113d7749e82..f6ee7a7253006 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/lib/s3/source-action.ts +++ b/packages/@aws-cdk/aws-codepipeline-actions/lib/s3/source-action.ts @@ -3,6 +3,31 @@ import targets = require('@aws-cdk/aws-events-targets'); import s3 = require('@aws-cdk/aws-s3'); import { sourceArtifactBounds } from '../common'; +/** + * How should the S3 Action detect changes. + * This is the type of the {@link S3SourceAction.trigger} property. + */ +export enum S3Trigger { + /** + * The Action will never detect changes - + * the Pipeline it's part of will only begin a run when explicitly started. + */ + NONE = 'None', + + /** + * CodePipeline will poll S3 to detect changes. + * This is the default method of detecting changes. + */ + POLL = 'Poll', + + /** + * CodePipeline will use CloudWatch Events to be notified of changes. + * Note that the Bucket that the Action uses needs to be part of a CloudTrail Trail + * for the events to be delivered. + */ + EVENTS = 'Events', +} + /** * Construction properties of the {@link S3SourceAction S3 source Action}. */ @@ -20,15 +45,14 @@ export interface S3SourceActionProps extends codepipeline.CommonActionProps { readonly bucketKey: string; /** - * Whether AWS CodePipeline should poll for source changes. - * If this is `false`, the Pipeline will use CloudWatch Events to detect source changes instead. - * Note that if this is `false`, you need to make sure to include the source Bucket in a CloudTrail Trail, + * How should CodePipeline detect source changes for this Action. + * Note that if this is S3Trigger.EVENTS, you need to make sure to include the source Bucket in a CloudTrail Trail, * as otherwise the CloudWatch Events will not be emitted. * - * @default true + * @default S3Trigger.POLL * @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/log-s3-data-events.html */ - readonly pollForSourceChanges?: boolean; + readonly trigger?: S3Trigger; /** * The Amazon S3 bucket that stores the source code @@ -46,6 +70,8 @@ export class S3SourceAction extends codepipeline.Action { private readonly props: S3SourceActionProps; constructor(props: S3SourceActionProps) { + const pollForSourceChanges = props.trigger && props.trigger === S3Trigger.POLL; + super({ ...props, category: codepipeline.ActionCategory.SOURCE, @@ -55,7 +81,7 @@ export class S3SourceAction extends codepipeline.Action { configuration: { S3Bucket: props.bucket.bucketName, S3ObjectKey: props.bucketKey, - PollForSourceChanges: props.pollForSourceChanges, + PollForSourceChanges: pollForSourceChanges, }, }); @@ -63,7 +89,7 @@ export class S3SourceAction extends codepipeline.Action { } protected bind(info: codepipeline.ActionBind): void { - if (this.props.pollForSourceChanges === false) { + if (this.props.trigger === S3Trigger.EVENTS) { this.props.bucket.onCloudTrailPutObject(info.pipeline.node.uniqueId + 'SourceEventRule', { target: new targets.CodePipeline(info.pipeline), paths: [this.props.bucketKey] diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/cloudformation/test.cloudformation-pipeline-actions.ts b/packages/@aws-cdk/aws-codepipeline-actions/test/cloudformation/test.cloudformation-pipeline-actions.ts index 3ae23fa3c5be6..123b773019dc8 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/cloudformation/test.cloudformation-pipeline-actions.ts +++ b/packages/@aws-cdk/aws-codepipeline-actions/test/cloudformation/test.cloudformation-pipeline-actions.ts @@ -31,7 +31,7 @@ export = { actionName: 'source', output: sourceOutput, repository: repo, - pollForSourceChanges: true, + trigger: cpactions.CodeCommitTrigger.POLL, }); pipeline.addStage({ stageName: 'source', diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/codecommit/test.codecommit-source-action.ts b/packages/@aws-cdk/aws-codepipeline-actions/test/codecommit/test.codecommit-source-action.ts new file mode 100644 index 0000000000000..cf61a8096b44d --- /dev/null +++ b/packages/@aws-cdk/aws-codepipeline-actions/test/codecommit/test.codecommit-source-action.ts @@ -0,0 +1,144 @@ +import { countResources, expect, haveResourceLike, not } from "@aws-cdk/assert"; +import codebuild = require('@aws-cdk/aws-codebuild'); +import codecommit = require('@aws-cdk/aws-codecommit'); +import codepipeline = require('@aws-cdk/aws-codepipeline'); +import { Stack } from "@aws-cdk/cdk"; +import { Test } from 'nodeunit'; +import cpactions = require('../../lib'); + +// tslint:disable:object-literal-key-quotes + +export = { + 'CodeCommit Source Action': { + 'by default does not poll for source changes and uses Events'(test: Test) { + const stack = new Stack(); + + minimalPipeline(stack, undefined); + + expect(stack).to(haveResourceLike('AWS::CodePipeline::Pipeline', { + "Stages": [ + { + "Actions": [ + { + "Configuration": { + "PollForSourceChanges": false, + }, + }, + ], + }, + {}, + ], + })); + + expect(stack).to(countResources('AWS::Events::Rule', 1)); + + test.done(); + }, + + 'does not poll for source changes and uses Events for CodeCommitTrigger.EVENTS'(test: Test) { + const stack = new Stack(); + + minimalPipeline(stack, cpactions.CodeCommitTrigger.EVENTS); + + expect(stack).to(haveResourceLike('AWS::CodePipeline::Pipeline', { + "Stages": [ + { + "Actions": [ + { + "Configuration": { + "PollForSourceChanges": false, + }, + }, + ], + }, + {}, + ], + })); + + expect(stack).to(countResources('AWS::Events::Rule', 1)); + + test.done(); + }, + + 'polls for source changes and does not use Events for CodeCommitTrigger.POLL'(test: Test) { + const stack = new Stack(); + + minimalPipeline(stack, cpactions.CodeCommitTrigger.POLL); + + expect(stack).to(haveResourceLike('AWS::CodePipeline::Pipeline', { + "Stages": [ + { + "Actions": [ + { + "Configuration": { + "PollForSourceChanges": true, + }, + }, + ], + }, + {}, + ], + })); + + expect(stack).to(not(haveResourceLike('AWS::Events::Rule'))); + + test.done(); + }, + + 'does not poll for source changes and does not use Events for CodeCommitTrigger.NONE'(test: Test) { + const stack = new Stack(); + + minimalPipeline(stack, cpactions.CodeCommitTrigger.NONE); + + expect(stack).to(haveResourceLike('AWS::CodePipeline::Pipeline', { + "Stages": [ + { + "Actions": [ + { + "Configuration": { + "PollForSourceChanges": false, + }, + }, + ], + }, + {}, + ], + })); + + expect(stack).to(not(haveResourceLike('AWS::Events::Rule'))); + + test.done(); + }, + }, +}; + +function minimalPipeline(stack: Stack, trigger: cpactions.CodeCommitTrigger | undefined): codepipeline.Pipeline { + const sourceOutput = new codepipeline.Artifact(); + return new codepipeline.Pipeline(stack, 'MyPipeline', { + stages: [ + { + stageName: 'Source', + actions: [ + new cpactions.CodeCommitSourceAction({ + actionName: 'Source', + repository: new codecommit.Repository(stack, 'MyRepo', { + repositoryName: 'my-repo', + }), + output: sourceOutput, + trigger, + }), + ], + }, + { + stageName: 'Build', + actions: [ + new cpactions.CodeBuildAction({ + actionName: 'Build', + project: new codebuild.PipelineProject(stack, 'MyProject'), + input: sourceOutput, + }), + ], + }, + ], + }); +} diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.cfn-template-from-repo.lit.ts b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.cfn-template-from-repo.lit.ts index 0e1d7dec0bc12..f50219c197c53 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.cfn-template-from-repo.lit.ts +++ b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.cfn-template-from-repo.lit.ts @@ -16,7 +16,7 @@ const source = new cpactions.CodeCommitSourceAction({ actionName: 'Source', repository: repo, output: sourceOutput, - pollForSourceChanges: true, + trigger: cpactions.CodeCommitTrigger.POLL, }); const sourceStage = { stageName: 'Source', diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.lambda-pipeline.ts b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.lambda-pipeline.ts index bfd13628586f0..a84483bc3e3e7 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.lambda-pipeline.ts +++ b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.lambda-pipeline.ts @@ -24,7 +24,7 @@ sourceStage.addAction(new cpactions.S3SourceAction({ output: new codepipeline.Artifact('SourceArtifact'), bucket, bucketKey: key, - pollForSourceChanges: false, + trigger: cpactions.S3Trigger.EVENTS, })); const lambdaFun = new lambda.Function(stack, 'LambdaFun', { diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-commit-build.ts b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-commit-build.ts index 42e64c80c0688..29ec7eeeee737 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-commit-build.ts +++ b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-commit-build.ts @@ -16,7 +16,7 @@ const sourceAction = new cpactions.CodeCommitSourceAction({ actionName: 'source', output: sourceOutput, repository, - pollForSourceChanges: true, + trigger: cpactions.CodeCommitTrigger.POLL, }); const project = new codebuild.PipelineProject(stack, 'MyBuildProject'); diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-events.ts b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-events.ts index 47a6d2afc9776..dd6b0ff5b860d 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-events.ts +++ b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-events.ts @@ -25,7 +25,7 @@ const sourceAction = new cpactions.CodeCommitSourceAction({ actionName: 'CodeCommitSource', output: sourceOutput, repository, - pollForSourceChanges: true, + trigger: cpactions.CodeCommitTrigger.POLL, }); const sourceStage = pipeline.addStage({ stageName: 'Source', diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/s3/test.s3-source-action.ts b/packages/@aws-cdk/aws-codepipeline-actions/test/s3/test.s3-source-action.ts new file mode 100644 index 0000000000000..84a024f12a997 --- /dev/null +++ b/packages/@aws-cdk/aws-codepipeline-actions/test/s3/test.s3-source-action.ts @@ -0,0 +1,142 @@ +import { countResources, expect, haveResourceLike, not } from "@aws-cdk/assert"; +import codebuild = require('@aws-cdk/aws-codebuild'); +import codepipeline = require('@aws-cdk/aws-codepipeline'); +import s3 = require('@aws-cdk/aws-s3'); +import { Stack } from "@aws-cdk/cdk"; +import { Test } from 'nodeunit'; +import cpactions = require('../../lib'); + +// tslint:disable:object-literal-key-quotes + +export = { + 'S3 Source Action': { + 'by default polls for source changes and does not use Events'(test: Test) { + const stack = new Stack(); + + minimalPipeline(stack, undefined); + + expect(stack).to(haveResourceLike('AWS::CodePipeline::Pipeline', { + "Stages": [ + { + "Actions": [ + { + "Configuration": { + }, + }, + ], + }, + {}, + ], + })); + + expect(stack).to(not(haveResourceLike('AWS::Events::Rule'))); + + test.done(); + }, + + 'does not poll for source changes and uses Events for S3Trigger.EVENTS'(test: Test) { + const stack = new Stack(); + + minimalPipeline(stack, cpactions.S3Trigger.EVENTS); + + expect(stack).to(haveResourceLike('AWS::CodePipeline::Pipeline', { + "Stages": [ + { + "Actions": [ + { + "Configuration": { + "PollForSourceChanges": false, + }, + }, + ], + }, + {}, + ], + })); + + expect(stack).to(countResources('AWS::Events::Rule', 1)); + + test.done(); + }, + + 'polls for source changes and does not use Events for S3Trigger.POLL'(test: Test) { + const stack = new Stack(); + + minimalPipeline(stack, cpactions.S3Trigger.POLL); + + expect(stack).to(haveResourceLike('AWS::CodePipeline::Pipeline', { + "Stages": [ + { + "Actions": [ + { + "Configuration": { + "PollForSourceChanges": true, + }, + }, + ], + }, + {}, + ], + })); + + expect(stack).to(not(haveResourceLike('AWS::Events::Rule'))); + + test.done(); + }, + + 'does not poll for source changes and does not use Events for S3Trigger.NONE'(test: Test) { + const stack = new Stack(); + + minimalPipeline(stack, cpactions.S3Trigger.NONE); + + expect(stack).to(haveResourceLike('AWS::CodePipeline::Pipeline', { + "Stages": [ + { + "Actions": [ + { + "Configuration": { + "PollForSourceChanges": false, + }, + }, + ], + }, + {}, + ], + })); + + expect(stack).to(not(haveResourceLike('AWS::Events::Rule'))); + + test.done(); + }, + }, +}; + +function minimalPipeline(stack: Stack, trigger: cpactions.S3Trigger | undefined): codepipeline.Pipeline { + const sourceOutput = new codepipeline.Artifact(); + return new codepipeline.Pipeline(stack, 'MyPipeline', { + stages: [ + { + stageName: 'Source', + actions: [ + new cpactions.S3SourceAction({ + actionName: 'Source', + bucket: new s3.Bucket(stack, 'MyBucket'), + bucketKey: 'some/path/to', + output: sourceOutput, + trigger, + }), + ], + }, + { + stageName: 'Build', + actions: [ + new cpactions.CodeBuildAction({ + actionName: 'Build', + project: new codebuild.PipelineProject(stack, 'MyProject'), + input: sourceOutput, + }), + ], + }, + ], + }); +} diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/test.pipeline.ts b/packages/@aws-cdk/aws-codepipeline-actions/test/test.pipeline.ts index f3f62f33bcec1..f5525fbb65b80 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/test.pipeline.ts +++ b/packages/@aws-cdk/aws-codepipeline-actions/test/test.pipeline.ts @@ -554,35 +554,6 @@ export = { test.done(); }, - 'CodeCommit Action': { - 'does not poll for changes by default'(test: Test) { - const stack = new Stack(); - const sourceAction = new cpactions.CodeCommitSourceAction({ - actionName: 'stage', - output: new codepipeline.Artifact('SomeArtifact'), - repository: repositoryForTesting(stack), - }); - - test.equal(sourceAction.configuration.PollForSourceChanges, false); - - test.done(); - }, - - 'does not poll for source changes when explicitly set to false'(test: Test) { - const stack = new Stack(); - const sourceAction = new cpactions.CodeCommitSourceAction({ - actionName: 'stage', - output: new codepipeline.Artifact('SomeArtifact'), - repository: repositoryForTesting(stack), - pollForSourceChanges: false, - }); - - test.equal(sourceAction.configuration.PollForSourceChanges, false); - - test.done(); - }, - }, - 'cross-region Pipeline': { 'generates the required Action & ArtifactStores properties in the template'(test: Test) { const pipelineRegion = 'us-west-2'; @@ -867,9 +838,3 @@ function stageForTesting(stack: Stack): codepipeline.IStage { const pipeline = new codepipeline.Pipeline(stack, 'pipeline'); return pipeline.addStage({ stageName: 'stage' }); } - -function repositoryForTesting(stack: Stack): codecommit.Repository { - return new codecommit.Repository(stack, 'Repository', { - repositoryName: 'Repository', - }); -} diff --git a/packages/@aws-cdk/aws-codepipeline/lib/pipeline.ts b/packages/@aws-cdk/aws-codepipeline/lib/pipeline.ts index 48a5dd232c61b..9d23f108dcaa8 100644 --- a/packages/@aws-cdk/aws-codepipeline/lib/pipeline.ts +++ b/packages/@aws-cdk/aws-codepipeline/lib/pipeline.ts @@ -47,7 +47,7 @@ export interface StageProps { readonly actions?: Action[]; } -export interface StageAddToPipelineProps extends StageProps { +export interface StageOptions extends StageProps { readonly placement?: StagePlacement; } @@ -287,7 +287,7 @@ export class Pipeline extends PipelineBase { * @param props the creation properties of the new Stage * @returns the newly created Stage */ - public addStage(props: StageAddToPipelineProps): IStage { + public addStage(props: StageOptions): IStage { // check for duplicate Stages and names if (this.stages.find(s => s.stageName === props.stageName)) { throw new Error(`Stage with duplicate name '${props.stageName}' added to the Pipeline`);