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

feat(cloudformation): allow specifying additional inputs for deploy Actions #2020

Merged
merged 5 commits into from
Mar 15, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Make Action#addOutputArtifact idempotent.
  • Loading branch information
skinny85 committed Mar 15, 2019
commit 4c18d0bc68535fa2411ed2e4e4902e7ec83f7b9c
7 changes: 7 additions & 0 deletions packages/@aws-cdk/aws-codepipeline-api/lib/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,13 @@ export abstract class Action {
}

protected addOutputArtifact(name: string): Artifact {
// adding the same name multiple times doesn't do anything -
// addOutputArtifact is idempotent
const ret = this._outputArtifacts.find(output => output.artifactName === name);
if (ret) {
return ret;
}

const artifact = new Artifact(name);
this._actionOutputArtifacts.push(artifact);
return artifact;
Expand Down
22 changes: 22 additions & 0 deletions packages/@aws-cdk/aws-codepipeline/test/test.action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,28 @@ export = {
test.done();
},
},

'output Artifact names': {
'accept the same name multiple times safely'(test: Test) {
const artifact = new actions.Artifact('SomeArtifact');

const stack = new cdk.Stack();
const project = new codebuild.PipelineProject(stack, 'Project');
const action = project.toCodePipelineBuildAction({
actionName: 'CodeBuild',
inputArtifact: artifact,
outputArtifactName: 'Artifact1',
additionalOutputArtifactNames: [
'Artifact1',
'Artifact1',
],
});

test.equal(action._outputArtifacts.length, 1);

test.done();
},
},
};

function boundsValidationResult(numberOfArtifacts: number, min: number, max: number): string[] {
Expand Down