-
Notifications
You must be signed in to change notification settings - Fork 4k
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(alexa-ask): Add deploy action for Alexa #1613
Conversation
The build is failing, but this looks great! I think the build was broken when you submitted this and was recently fixed by this PR: #1616 A re-run will likely pass. |
|
||
const deployStage = new codepipeline.Stage(pipeline, 'Deploy', { pipeline }); | ||
|
||
const clientId = new cdk.SecretParameter(stack, 'AlexaClientId', {ssmParameter: '/Alexa/ClientId'}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That integration test won't deploy unless the SSM Parameters exist, right? It'd be nice to somehow swap those out for phony values or locally-created entities instead, so the test can run without any pre-requisite set-up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. I changed it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great @hoegertn , thanks so much for another contribution!
I have a few minor comments/questions, but nothing serious.
|
||
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'}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you have to repeat these here - they're the same as above, so they don't really bring new information. I would just delete these.
/** | ||
* The source artifact containing the voice model and skill manifest | ||
*/ | ||
inputArtifact: codepipeline.Artifact; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be optional, inputArtifact?: ...
.
minInputs: 1, | ||
maxInputs: 2, | ||
minOutputs: 0, | ||
maxOutputs: 1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this Action really have outputs? Deployment Actions almost never do... If 'yes', what is that output?
/** | ||
* An optional artifact containing overrides for the skill manifest | ||
*/ | ||
overrideArtifact?: codepipeline.Artifact; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not in love with this name. How about something like skillManifestArtifact
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I chose the name because Alexa calls these parameters overrides. It is not the Skill manifest but a JSON containing overrides for the manifest provided as inputArtifact. Normally this is an output of CFN with the Lambda ARN.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. Can you change this to parameterOverridesArtifact
then? Thanks!
RefreshToken: props.refreshToken, | ||
SkillId: props.skillId, | ||
}, | ||
inputArtifact: props.inputArtifact, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use TypeScript's spread operator here instead:
super(scope, id, {
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,
},
...props,
});
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's usually safer to use the spread operator up-front, unless you are intentionally allowing whoever provided props
to override the other keys?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've taken the liberty to move the splat up in the latest revision - that feels a lot safer to me.
@@ -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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be above the cdk
dependency (we try to keep them in alphabetical order).
}, | ||
"peerDependencies": { | ||
"@aws-cdk/cdk": "^0.22.0" | ||
"@aws-cdk/cdk": "^0.22.0", | ||
"@aws-cdk/aws-codepipeline-api": "^0.22.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here as above (order).
@@ -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", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be the first dependency (alphabetical order).
runOrder: 1, | ||
inputArtifact: sourceAction.outputArtifact, | ||
clientId: new Secret('clientId'), | ||
clientSecret: new Secret('clientSecret'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the cdk
import for these: new cdk.Secret(...)
.
Thanks for the feedback. Should all be fixed now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's still the question of the whether this can produce outputs that I asked in my previous review.
I'm asking, as that actually influences the API of the Action. If an output can be produced, we might have to add an optional property to its construction props, in order to be able to name the output Artifact, and also an optional field on the Action itself that allows access to it.
/** | ||
* An optional artifact containing overrides for the skill manifest | ||
*/ | ||
overrideArtifact?: codepipeline.Artifact; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. Can you change this to parameterOverridesArtifact
then? Thanks!
@skinny85 I changed it to parameterOverridesArtifact. The outputs are now 0 so this should answer your question. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, LGTM! Thanks a lot @hoegertn!
Thanks, for the review and the comments. Any idea when the next release will be and if this change will make it into the release? I am talking at the Berlin Summit about CI/CD for Alexa Skills and it would be great to be able to use it. |
@hoegertn no promises, but I'm pretty confident this will be part of the next release, which I am hoping will happen early next week. |
Pull Request Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license.