From 63abd8d4b5f4dbc25eb078ea9ec92da2e5ac881a Mon Sep 17 00:00:00 2001 From: Thorsten Hoeger Date: Fri, 25 Jan 2019 22:39:44 +0100 Subject: [PATCH 1/5] feat(alexa-ask): Add deploy action for Alexa --- packages/@aws-cdk/alexa-ask/README.md | 52 +++++ packages/@aws-cdk/alexa-ask/lib/index.ts | 1 + .../alexa-ask/lib/pipeline-actions.ts | 69 ++++++ packages/@aws-cdk/alexa-ask/package.json | 8 +- .../@aws-cdk/aws-codepipeline/package.json | 1 + .../integ.pipeline-alexa-deploy.expected.json | 212 ++++++++++++++++++ .../test/integ.pipeline-alexa-deploy.ts | 39 ++++ 7 files changed, 379 insertions(+), 3 deletions(-) create mode 100644 packages/@aws-cdk/alexa-ask/lib/pipeline-actions.ts create mode 100644 packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-alexa-deploy.expected.json create mode 100644 packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-alexa-deploy.ts diff --git a/packages/@aws-cdk/alexa-ask/README.md b/packages/@aws-cdk/alexa-ask/README.md index d9b65d34f8459..776de5d41be72 100644 --- a/packages/@aws-cdk/alexa-ask/README.md +++ b/packages/@aws-cdk/alexa-ask/README.md @@ -3,3 +3,55 @@ ```ts const alexaAsk = require('@aws-cdk/alexa-ask'); ``` + +### Alexa as deploy target for CodePipeline + +You can deploy to Alexa using CodePipeline with the following DeployAction. + +```ts +// Read the secrets from ParameterStore +const clientId = new cdk.SecretParameter(stack, 'AlexaClientId', {ssmParameter: '/Alexa/ClientId'}); +const clientSecret = new cdk.SecretParameter(stack, 'AlexaClientSecret', {ssmParameter: '/Alexa/ClientSecret'}); +const refreshToken = new cdk.SecretParameter(stack, 'AlexaRefreshToken', {ssmParameter: '/Alexa/RefreshToken'}); + +// Add deploy action +new alexa.AlexaSkillDeployAction(stack, 'DeploySkill', { + stage: deployStage, + runOrder: 1, + inputArtifact: sourceAction.outputArtifact, + clientId: clientId.value, + clientSecret: clientSecret.value, + refreshToken: refreshToken.value, + skillId: 'amzn1.ask.skill.12345678-1234-1234-1234-123456789012', +}); +``` + +If you need manifest overrides you can specify them as `overrideArtifact` in the action. + +```ts +// Deploy some CFN change set and store output +const executeChangeSetAction = new PipelineExecuteChangeSetAction(this, 'ExecuteChangesTest', { + stage: deployStage, + runOrder: 2, + stackName, + changeSetName, + outputFileName: 'overrides.json', + outputArtifactName: 'CloudFormation', +}); + +const clientId = new SecretParameter(this, 'AlexaClientId', {ssmParameter: '/Alexa/ClientId'}); +const clientSecret = new SecretParameter(this, 'AlexaClientSecret', {ssmParameter: '/Alexa/ClientSecret'}); +const refreshToken = new SecretParameter(this, 'AlexaRefreshToken', {ssmParameter: '/Alexa/RefreshToken'}); + +// Provide CFN output as manifest overrides +new AlexaSkillDeployAction(this, 'DeploySkill', { + stage: deployStage, + runOrder: 1, + inputArtifact: sourceAction.outputArtifact, + overrideArtifact: executeChangeSetAction.outputArtifact, + clientId: clientId.value, + clientSecret: clientSecret.value, + refreshToken: refreshToken.value, + skillId: 'amzn1.ask.skill.12345678-1234-1234-1234-123456789012', +}); +``` \ No newline at end of file diff --git a/packages/@aws-cdk/alexa-ask/lib/index.ts b/packages/@aws-cdk/alexa-ask/lib/index.ts index 59194e547cc5a..a691e2ef6e3cb 100644 --- a/packages/@aws-cdk/alexa-ask/lib/index.ts +++ b/packages/@aws-cdk/alexa-ask/lib/index.ts @@ -1,2 +1,3 @@ // Alexa::ASK CloudFormation Resources: export * from './ask.generated'; +export * from './pipeline-actions'; diff --git a/packages/@aws-cdk/alexa-ask/lib/pipeline-actions.ts b/packages/@aws-cdk/alexa-ask/lib/pipeline-actions.ts new file mode 100644 index 0000000000000..7a13839df1f6f --- /dev/null +++ b/packages/@aws-cdk/alexa-ask/lib/pipeline-actions.ts @@ -0,0 +1,69 @@ +import codepipeline = require('@aws-cdk/aws-codepipeline-api'); +import cdk = require('@aws-cdk/cdk'); + +/** + * Construction properties of the {@link AlexaSkillDeployAction Alexa deploy Action}. + */ +export interface AlexaSkillDeployActionProps extends codepipeline.CommonActionProps, + codepipeline.CommonActionConstructProps { + + /** + * The client id of the developer console token + */ + clientId: cdk.Secret; + + /** + * The client secret of the developer console token + */ + clientSecret: cdk.Secret; + + /** + * The refresh token of the developer console token + */ + refreshToken: cdk.Secret; + + /** + * The Alexa skill id + */ + skillId: string; + + /** + * The source artifact containing the voice model and skill manifest + */ + inputArtifact: codepipeline.Artifact; + + /** + * An optional artifact containing overrides for the skill manifest + */ + overrideArtifact?: codepipeline.Artifact; +} + +/** + * Deploys the skill to Alexa + */ +export class AlexaSkillDeployAction extends codepipeline.DeployAction { + constructor(scope: cdk.Construct, id: string, props: AlexaSkillDeployActionProps) { + super(scope, id, { + stage: props.stage, + runOrder: props.runOrder, + artifactBounds: { + minInputs: 1, + maxInputs: 2, + minOutputs: 0, + maxOutputs: 1, + }, + owner: 'ThirdParty', + provider: 'AlexaSkillsKit', + configuration: { + ClientId: props.clientId, + ClientSecret: props.clientSecret, + RefreshToken: props.refreshToken, + SkillId: props.skillId, + }, + inputArtifact: props.inputArtifact, + }); + if (props.overrideArtifact) { + this.addInputArtifact(props.overrideArtifact); + } + } +} diff --git a/packages/@aws-cdk/alexa-ask/package.json b/packages/@aws-cdk/alexa-ask/package.json index bb90ccb028d26..165846fb6eeaa 100644 --- a/packages/@aws-cdk/alexa-ask/package.json +++ b/packages/@aws-cdk/alexa-ask/package.json @@ -61,12 +61,14 @@ "pkglint": "^0.22.0" }, "dependencies": { - "@aws-cdk/cdk": "^0.22.0" + "@aws-cdk/cdk": "^0.22.0", + "@aws-cdk/aws-codepipeline-api": "^0.22.0" }, "peerDependencies": { - "@aws-cdk/cdk": "^0.22.0" + "@aws-cdk/cdk": "^0.22.0", + "@aws-cdk/aws-codepipeline-api": "^0.22.0" }, "engines": { "node": ">= 8.10.0" } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-codepipeline/package.json b/packages/@aws-cdk/aws-codepipeline/package.json index a797d2cb9f7c1..ca88c1e267c63 100644 --- a/packages/@aws-cdk/aws-codepipeline/package.json +++ b/packages/@aws-cdk/aws-codepipeline/package.json @@ -68,6 +68,7 @@ "@aws-cdk/aws-codedeploy": "^0.22.0", "@aws-cdk/aws-ecr": "^0.22.0", "@aws-cdk/aws-lambda": "^0.22.0", + "@aws-cdk/alexa-ask": "^0.22.0", "cdk-build-tools": "^0.22.0", "cdk-integ-tools": "^0.22.0", "cfn2ts": "^0.22.0", diff --git a/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-alexa-deploy.expected.json b/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-alexa-deploy.expected.json new file mode 100644 index 0000000000000..d4b3282de5f8f --- /dev/null +++ b/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-alexa-deploy.expected.json @@ -0,0 +1,212 @@ +{ + "Resources": { + "PipelineArtifactsBucket22248F97": { + "Type": "AWS::S3::Bucket", + "DeletionPolicy": "Retain" + }, + "PipelineRoleD68726F7": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "codepipeline.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "PipelineRoleDefaultPolicyC7A05455": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "s3:GetObject*", + "s3:GetBucket*", + "s3:List*", + "s3:DeleteObject*", + "s3:PutObject*", + "s3:Abort*" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucket22248F97", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucket22248F97", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": [ + "s3:GetObject*", + "s3:GetBucket*", + "s3:List*" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineBucketB967BD35", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineBucketB967BD35", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "PipelineRoleDefaultPolicyC7A05455", + "Roles": [ + { + "Ref": "PipelineRoleD68726F7" + } + ] + } + }, + "PipelineC660917D": { + "Type": "AWS::CodePipeline::Pipeline", + "Properties": { + "RoleArn": { + "Fn::GetAtt": [ + "PipelineRoleD68726F7", + "Arn" + ] + }, + "Stages": [ + { + "Actions": [ + { + "ActionTypeId": { + "Category": "Source", + "Owner": "AWS", + "Provider": "S3", + "Version": "1" + }, + "Configuration": { + "S3Bucket": { + "Ref": "PipelineBucketB967BD35" + }, + "S3ObjectKey": "key" + }, + "InputArtifacts": [], + "Name": "Source", + "OutputArtifacts": [ + { + "Name": "SourceArtifact" + } + ], + "RunOrder": 1 + } + ], + "Name": "Source" + }, + { + "Actions": [ + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "ThirdParty", + "Provider": "AlexaSkillsKit", + "Version": "1" + }, + "Configuration": { + "ClientId": { + "Ref": "AlexaClientIdParameter75B42E44" + }, + "ClientSecret": { + "Ref": "AlexaClientSecretParameterDDEA523F" + }, + "RefreshToken": { + "Ref": "AlexaRefreshTokenParameter07AA5F6D" + }, + "SkillId": "amzn1.ask.skill.12345678-1234-1234-1234-123456789012" + }, + "InputArtifacts": [ + { + "Name": "SourceArtifact" + } + ], + "Name": "DeploySkill", + "OutputArtifacts": [], + "RunOrder": 1 + } + ], + "Name": "Deploy" + } + ], + "ArtifactStore": { + "Location": { + "Ref": "PipelineArtifactsBucket22248F97" + }, + "Type": "S3" + } + }, + "DependsOn": [ + "PipelineRoleD68726F7", + "PipelineRoleDefaultPolicyC7A05455" + ] + }, + "PipelineBucketB967BD35": { + "Type": "AWS::S3::Bucket", + "Properties": { + "VersioningConfiguration": { + "Status": "Enabled" + } + } + } + }, + "Parameters": { + "AlexaClientIdParameter75B42E44": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/Alexa/ClientId", + "NoEcho": true + }, + "AlexaClientSecretParameterDDEA523F": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/Alexa/ClientSecret", + "NoEcho": true + }, + "AlexaRefreshTokenParameter07AA5F6D": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/Alexa/RefreshToken", + "NoEcho": true + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-alexa-deploy.ts b/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-alexa-deploy.ts new file mode 100644 index 0000000000000..84c6885158842 --- /dev/null +++ b/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-alexa-deploy.ts @@ -0,0 +1,39 @@ +import alexa = require('@aws-cdk/alexa-ask'); +import s3 = require('@aws-cdk/aws-s3'); +import cdk = require('@aws-cdk/cdk'); +import codepipeline = require('../lib'); + +const app = new cdk.App(); + +const stack = new cdk.Stack(app, 'aws-cdk-codepipeline-alexa-deploy'); + +const pipeline = new codepipeline.Pipeline(stack, 'Pipeline'); + +const sourceStage = new codepipeline.Stage(pipeline, 'Source', { pipeline }); +const bucket = new s3.Bucket(stack, 'PipelineBucket', { + versioned: true, + removalPolicy: cdk.RemovalPolicy.Destroy, +}); +const sourceAction = new s3.PipelineSourceAction(stack, 'Source', { + stage: sourceStage, + outputArtifactName: 'SourceArtifact', + bucket, + bucketKey: 'key', +}); + +const deployStage = new codepipeline.Stage(pipeline, 'Deploy', { pipeline }); + +const clientId = new cdk.SecretParameter(stack, 'AlexaClientId', {ssmParameter: '/Alexa/ClientId'}); +const clientSecret = new cdk.SecretParameter(stack, 'AlexaClientSecret', {ssmParameter: '/Alexa/ClientSecret'}); +const refreshToken = new cdk.SecretParameter(stack, 'AlexaRefreshToken', {ssmParameter: '/Alexa/RefreshToken'}); +new alexa.AlexaSkillDeployAction(stack, 'DeploySkill', { + stage: deployStage, + runOrder: 1, + inputArtifact: sourceAction.outputArtifact, + clientId: clientId.value, + clientSecret: clientSecret.value, + refreshToken: refreshToken.value, + skillId: 'amzn1.ask.skill.12345678-1234-1234-1234-123456789012', +}); + +app.run(); From 566845673b085874963f41691108dce2de0f8708 Mon Sep 17 00:00:00 2001 From: Thorsten Hoeger Date: Mon, 28 Jan 2019 11:22:06 +0100 Subject: [PATCH 2/5] feat(alexa-ask): Add deploy action for Alexa --- .../integ.pipeline-alexa-deploy.expected.json | 29 ++----------------- .../test/integ.pipeline-alexa-deploy.ts | 10 +++---- 2 files changed, 7 insertions(+), 32 deletions(-) diff --git a/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-alexa-deploy.expected.json b/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-alexa-deploy.expected.json index d4b3282de5f8f..f65ac6af5d5f4 100644 --- a/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-alexa-deploy.expected.json +++ b/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-alexa-deploy.expected.json @@ -147,15 +147,9 @@ "Version": "1" }, "Configuration": { - "ClientId": { - "Ref": "AlexaClientIdParameter75B42E44" - }, - "ClientSecret": { - "Ref": "AlexaClientSecretParameterDDEA523F" - }, - "RefreshToken": { - "Ref": "AlexaRefreshTokenParameter07AA5F6D" - }, + "ClientId": "clientId", + "ClientSecret": "clientSecret", + "RefreshToken": "refreshToken", "SkillId": "amzn1.ask.skill.12345678-1234-1234-1234-123456789012" }, "InputArtifacts": [ @@ -191,22 +185,5 @@ } } } - }, - "Parameters": { - "AlexaClientIdParameter75B42E44": { - "Type": "AWS::SSM::Parameter::Value", - "Default": "/Alexa/ClientId", - "NoEcho": true - }, - "AlexaClientSecretParameterDDEA523F": { - "Type": "AWS::SSM::Parameter::Value", - "Default": "/Alexa/ClientSecret", - "NoEcho": true - }, - "AlexaRefreshTokenParameter07AA5F6D": { - "Type": "AWS::SSM::Parameter::Value", - "Default": "/Alexa/RefreshToken", - "NoEcho": true - } } } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-alexa-deploy.ts b/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-alexa-deploy.ts index 84c6885158842..36165b457bea3 100644 --- a/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-alexa-deploy.ts +++ b/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-alexa-deploy.ts @@ -1,6 +1,7 @@ import alexa = require('@aws-cdk/alexa-ask'); import s3 = require('@aws-cdk/aws-s3'); import cdk = require('@aws-cdk/cdk'); +import { Secret } from '@aws-cdk/cdk'; import codepipeline = require('../lib'); const app = new cdk.App(); @@ -23,16 +24,13 @@ const sourceAction = new s3.PipelineSourceAction(stack, 'Source', { const deployStage = new codepipeline.Stage(pipeline, 'Deploy', { pipeline }); -const clientId = new cdk.SecretParameter(stack, 'AlexaClientId', {ssmParameter: '/Alexa/ClientId'}); -const clientSecret = new cdk.SecretParameter(stack, 'AlexaClientSecret', {ssmParameter: '/Alexa/ClientSecret'}); -const refreshToken = new cdk.SecretParameter(stack, 'AlexaRefreshToken', {ssmParameter: '/Alexa/RefreshToken'}); new alexa.AlexaSkillDeployAction(stack, 'DeploySkill', { stage: deployStage, runOrder: 1, inputArtifact: sourceAction.outputArtifact, - clientId: clientId.value, - clientSecret: clientSecret.value, - refreshToken: refreshToken.value, + clientId: new Secret('clientId'), + clientSecret: new Secret('clientSecret'), + refreshToken: new Secret('refreshToken'), skillId: 'amzn1.ask.skill.12345678-1234-1234-1234-123456789012', }); From 3a0990fb88c89ffcc2f0518da9a56e946c2cf5c2 Mon Sep 17 00:00:00 2001 From: Thorsten Hoeger Date: Tue, 29 Jan 2019 07:41:17 +0100 Subject: [PATCH 3/5] PR feedback --- packages/@aws-cdk/alexa-ask/README.md | 4 ---- packages/@aws-cdk/alexa-ask/lib/pipeline-actions.ts | 8 +++----- packages/@aws-cdk/alexa-ask/package.json | 8 ++++---- packages/@aws-cdk/aws-codepipeline/package.json | 2 +- .../aws-codepipeline/test/integ.pipeline-alexa-deploy.ts | 7 +++---- 5 files changed, 11 insertions(+), 18 deletions(-) diff --git a/packages/@aws-cdk/alexa-ask/README.md b/packages/@aws-cdk/alexa-ask/README.md index 776de5d41be72..e9bdebedd94e8 100644 --- a/packages/@aws-cdk/alexa-ask/README.md +++ b/packages/@aws-cdk/alexa-ask/README.md @@ -39,10 +39,6 @@ const executeChangeSetAction = new PipelineExecuteChangeSetAction(this, 'Execute outputArtifactName: 'CloudFormation', }); -const clientId = new SecretParameter(this, 'AlexaClientId', {ssmParameter: '/Alexa/ClientId'}); -const clientSecret = new SecretParameter(this, 'AlexaClientSecret', {ssmParameter: '/Alexa/ClientSecret'}); -const refreshToken = new SecretParameter(this, 'AlexaRefreshToken', {ssmParameter: '/Alexa/RefreshToken'}); - // Provide CFN output as manifest overrides new AlexaSkillDeployAction(this, 'DeploySkill', { stage: deployStage, diff --git a/packages/@aws-cdk/alexa-ask/lib/pipeline-actions.ts b/packages/@aws-cdk/alexa-ask/lib/pipeline-actions.ts index 7a13839df1f6f..fb7088fac20fe 100644 --- a/packages/@aws-cdk/alexa-ask/lib/pipeline-actions.ts +++ b/packages/@aws-cdk/alexa-ask/lib/pipeline-actions.ts @@ -30,7 +30,7 @@ export interface AlexaSkillDeployActionProps extends codepipeline.CommonActionPr /** * The source artifact containing the voice model and skill manifest */ - inputArtifact: codepipeline.Artifact; + inputArtifact?: codepipeline.Artifact; /** * An optional artifact containing overrides for the skill manifest @@ -44,13 +44,11 @@ export interface AlexaSkillDeployActionProps extends codepipeline.CommonActionPr export class AlexaSkillDeployAction extends codepipeline.DeployAction { constructor(scope: cdk.Construct, id: string, props: AlexaSkillDeployActionProps) { super(scope, id, { - stage: props.stage, - runOrder: props.runOrder, artifactBounds: { minInputs: 1, maxInputs: 2, minOutputs: 0, - maxOutputs: 1, + maxOutputs: 0, }, owner: 'ThirdParty', provider: 'AlexaSkillsKit', @@ -60,7 +58,7 @@ export class AlexaSkillDeployAction extends codepipeline.DeployAction { RefreshToken: props.refreshToken, SkillId: props.skillId, }, - inputArtifact: props.inputArtifact, + ...props, }); if (props.overrideArtifact) { this.addInputArtifact(props.overrideArtifact); diff --git a/packages/@aws-cdk/alexa-ask/package.json b/packages/@aws-cdk/alexa-ask/package.json index 165846fb6eeaa..6453f3fee4230 100644 --- a/packages/@aws-cdk/alexa-ask/package.json +++ b/packages/@aws-cdk/alexa-ask/package.json @@ -61,12 +61,12 @@ "pkglint": "^0.22.0" }, "dependencies": { - "@aws-cdk/cdk": "^0.22.0", - "@aws-cdk/aws-codepipeline-api": "^0.22.0" + "@aws-cdk/aws-codepipeline-api": "^0.22.0", + "@aws-cdk/cdk": "^0.22.0" }, "peerDependencies": { - "@aws-cdk/cdk": "^0.22.0", - "@aws-cdk/aws-codepipeline-api": "^0.22.0" + "@aws-cdk/aws-codepipeline-api": "^0.22.0", + "@aws-cdk/cdk": "^0.22.0" }, "engines": { "node": ">= 8.10.0" diff --git a/packages/@aws-cdk/aws-codepipeline/package.json b/packages/@aws-cdk/aws-codepipeline/package.json index ca88c1e267c63..6b1a4d7473858 100644 --- a/packages/@aws-cdk/aws-codepipeline/package.json +++ b/packages/@aws-cdk/aws-codepipeline/package.json @@ -60,6 +60,7 @@ }, "license": "Apache-2.0", "devDependencies": { + "@aws-cdk/alexa-ask": "^0.22.0", "@aws-cdk/assert": "^0.22.0", "@aws-cdk/aws-cloudformation": "^0.22.0", "@aws-cdk/aws-cloudtrail": "^0.22.0", @@ -68,7 +69,6 @@ "@aws-cdk/aws-codedeploy": "^0.22.0", "@aws-cdk/aws-ecr": "^0.22.0", "@aws-cdk/aws-lambda": "^0.22.0", - "@aws-cdk/alexa-ask": "^0.22.0", "cdk-build-tools": "^0.22.0", "cdk-integ-tools": "^0.22.0", "cfn2ts": "^0.22.0", diff --git a/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-alexa-deploy.ts b/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-alexa-deploy.ts index 36165b457bea3..d01f6147d57e7 100644 --- a/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-alexa-deploy.ts +++ b/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-alexa-deploy.ts @@ -1,7 +1,6 @@ import alexa = require('@aws-cdk/alexa-ask'); import s3 = require('@aws-cdk/aws-s3'); import cdk = require('@aws-cdk/cdk'); -import { Secret } from '@aws-cdk/cdk'; import codepipeline = require('../lib'); const app = new cdk.App(); @@ -28,9 +27,9 @@ new alexa.AlexaSkillDeployAction(stack, 'DeploySkill', { stage: deployStage, runOrder: 1, inputArtifact: sourceAction.outputArtifact, - clientId: new Secret('clientId'), - clientSecret: new Secret('clientSecret'), - refreshToken: new Secret('refreshToken'), + clientId: new cdk.Secret('clientId'), + clientSecret: new cdk.Secret('clientSecret'), + refreshToken: new cdk.Secret('refreshToken'), skillId: 'amzn1.ask.skill.12345678-1234-1234-1234-123456789012', }); From 68a4222a6285c021ee291eac81332bdfab00d822 Mon Sep 17 00:00:00 2001 From: Thorsten Hoeger Date: Thu, 31 Jan 2019 08:25:03 +0100 Subject: [PATCH 4/5] rename parameterOverridesArtifact --- packages/@aws-cdk/alexa-ask/README.md | 2 +- packages/@aws-cdk/alexa-ask/lib/pipeline-actions.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/@aws-cdk/alexa-ask/README.md b/packages/@aws-cdk/alexa-ask/README.md index e9bdebedd94e8..9e3754166cf5d 100644 --- a/packages/@aws-cdk/alexa-ask/README.md +++ b/packages/@aws-cdk/alexa-ask/README.md @@ -44,7 +44,7 @@ new AlexaSkillDeployAction(this, 'DeploySkill', { stage: deployStage, runOrder: 1, inputArtifact: sourceAction.outputArtifact, - overrideArtifact: executeChangeSetAction.outputArtifact, + parameterOverridesArtifact: executeChangeSetAction.outputArtifact, clientId: clientId.value, clientSecret: clientSecret.value, refreshToken: refreshToken.value, diff --git a/packages/@aws-cdk/alexa-ask/lib/pipeline-actions.ts b/packages/@aws-cdk/alexa-ask/lib/pipeline-actions.ts index fb7088fac20fe..411bd546f6e2c 100644 --- a/packages/@aws-cdk/alexa-ask/lib/pipeline-actions.ts +++ b/packages/@aws-cdk/alexa-ask/lib/pipeline-actions.ts @@ -35,7 +35,7 @@ export interface AlexaSkillDeployActionProps extends codepipeline.CommonActionPr /** * An optional artifact containing overrides for the skill manifest */ - overrideArtifact?: codepipeline.Artifact; + parameterOverridesArtifact?: codepipeline.Artifact; } /** @@ -60,8 +60,8 @@ export class AlexaSkillDeployAction extends codepipeline.DeployAction { }, ...props, }); - if (props.overrideArtifact) { - this.addInputArtifact(props.overrideArtifact); + if (props.parameterOverridesArtifact) { + this.addInputArtifact(props.parameterOverridesArtifact); } } } From 9dcc6a79c165f1a910affe9025cc73fbf3250e19 Mon Sep 17 00:00:00 2001 From: Romain Marcadier-Muller Date: Fri, 1 Feb 2019 11:37:25 +0100 Subject: [PATCH 5/5] Moved spread up to the front --- packages/@aws-cdk/alexa-ask/lib/pipeline-actions.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@aws-cdk/alexa-ask/lib/pipeline-actions.ts b/packages/@aws-cdk/alexa-ask/lib/pipeline-actions.ts index 411bd546f6e2c..e74b267d75221 100644 --- a/packages/@aws-cdk/alexa-ask/lib/pipeline-actions.ts +++ b/packages/@aws-cdk/alexa-ask/lib/pipeline-actions.ts @@ -44,6 +44,7 @@ export interface AlexaSkillDeployActionProps extends codepipeline.CommonActionPr export class AlexaSkillDeployAction extends codepipeline.DeployAction { constructor(scope: cdk.Construct, id: string, props: AlexaSkillDeployActionProps) { super(scope, id, { + ...props, artifactBounds: { minInputs: 1, maxInputs: 2, @@ -58,7 +59,6 @@ export class AlexaSkillDeployAction extends codepipeline.DeployAction { RefreshToken: props.refreshToken, SkillId: props.skillId, }, - ...props, }); if (props.parameterOverridesArtifact) { this.addInputArtifact(props.parameterOverridesArtifact);