Skip to content

Commit

Permalink
feat(aws-codepipeline-actions): Add CAPABILITY_AUTO_EXPAND (aws#2851)
Browse files Browse the repository at this point in the history
Properly handle CloudFormationCapabilities.None
  • Loading branch information
ScOut3R committed Jun 13, 2019
1 parent 5f1c779 commit 501ece9
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,8 @@ function parseCapabilities(capabilities: any): any {
if (capabilities === undefined) {
return undefined;
} else if (capabilities.length === 1) {
return capabilities.toString();
const capability = capabilities.toString();
return (capability === '') ? undefined : capability;
} else if (capabilities.length > 1) {
return capabilities.join(',');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,48 @@ export = {

test.done();
},

'Empty capabilities is not passed to template'(test: Test) {
// GIVEN
const stack = new TestFixture();

// WHEN
stack.deployStage.addAction(new cpactions.CloudFormationCreateUpdateStackAction({
actionName: 'CreateUpdate',
stackName: 'MyStack',
templatePath: stack.sourceOutput.atPath('template.yaml'),
adminPermissions: false,
capabilities: [
CloudFormationCapabilities.None
]
}));

const roleId = "PipelineDeployCreateUpdateRole515CB7D4";

// THEN: Action in Pipeline has no capabilities
expect(stack).to(haveResourceLike('AWS::CodePipeline::Pipeline', {
"Stages": [
{ "Name": "Source" /* don't care about the rest */ },
{
"Name": "Deploy",
"Actions": [
{
"Configuration": {
"RoleArn": { "Fn::GetAtt": [ roleId, "Arn" ] },
"ActionMode": "CREATE_UPDATE",
"StackName": "MyStack",
"TemplatePath": "SourceArtifact::template.yaml"
},
"InputArtifacts": [{"Name": "SourceArtifact"}],
"Name": "CreateUpdate",
},
],
}
]
}));

test.done();
},
};

/**
Expand Down

0 comments on commit 501ece9

Please sign in to comment.