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(alexa-ask): Add deploy action for Alexa #1613

Merged
merged 5 commits into from
Feb 1, 2019
Merged

feat(alexa-ask): Add deploy action for Alexa #1613

merged 5 commits into from
Feb 1, 2019

Conversation

hoegertn
Copy link
Contributor


Pull Request Checklist

  • Testing
    • Unit test added
  • Docs
    • jsdocs: All public APIs documented
    • README: README and/or documentation topic updated
  • Title and Description
    • Change type: title prefixed with fix, feat will appear in changelog
    • Title: use lower-case and doesn't end with a period
    • Breaking?: last paragraph: "BREAKING CHANGE: <describe what changed + link for details>"
    • Issues: Indicate issues fixed via: "Fixes #xxx" or "Closes #xxx"
  • Sensitive Modules (requires 2 PR approvers)
    • IAM Policy Document (in @aws-cdk/aws-iam)
    • EC2 Security Groups and ACLs (in @aws-cdk/aws-ec2)
    • Grant APIs (only if not based on official documentation with a reference)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license.

@sam-goodwin
Copy link
Contributor

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'});
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

@skinny85 skinny85 left a 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'});
Copy link
Contributor

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;
Copy link
Contributor

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,
Copy link
Contributor

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;
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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,
Copy link
Contributor

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,
    });

Copy link
Contributor

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?

Copy link
Contributor

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"
Copy link
Contributor

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"
Copy link
Contributor

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",
Copy link
Contributor

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'),
Copy link
Contributor

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(...).

@hoegertn
Copy link
Contributor Author

Thanks for the feedback. Should all be fixed now.

Copy link
Contributor

@skinny85 skinny85 left a 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;
Copy link
Contributor

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!

@hoegertn
Copy link
Contributor Author

@skinny85 I changed it to parameterOverridesArtifact. The outputs are now 0 so this should answer your question.

Copy link
Contributor

@skinny85 skinny85 left a 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!

@hoegertn
Copy link
Contributor Author

hoegertn commented Feb 1, 2019

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.

@RomainMuller
Copy link
Contributor

@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.

@RomainMuller RomainMuller merged commit 0deea61 into aws:master Feb 1, 2019
@hoegertn hoegertn deleted the alexa-deploy branch September 27, 2019 07:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants