Skip to content

Resolve profile before performing aws-sdk dependent actions - #5744

Merged
dschep merged 2 commits into
masterfrom
fix-sls-4311
Jan 28, 2019
Merged

dschep merged 2 commits into
masterfrom
fix-sls-4311

Conversation

@dschep

@dschep dschep commented Jan 23, 2019

Copy link
Copy Markdown
Contributor

What did you implement:

closes #4311
closes #4725

How did you implement it:

  • added profile to list of variables that must resolve to a constant before SSM (and cfn & s3) variables are attempted to be resolved.
  • updated AwsProvider to check the aws-profile option instead of profile since that's what's actually implemented(afaik).
  • updated getProfileSourceValue return value to be more like that of the getStageSourceValue and getRegionSourceValue

How can we verify it:

set profile to a variable and try to sls print with stable install and then again with this branch

Todos:

  • Write tests
  • n/a Write documentation
  • Fix linting errors
  • Make sure code coverage hasn't dropped
  • Provide verification config / commands / resources
  • Enable "Allow edits from maintainers" for this PR
  • Update the messages below

Is this ready for review?: YES
Is it a breaking change?: NO

Comment thread lib/plugins/aws/provider/awsProvider.js Resolved
@dschep
dschep force-pushed the fix-sls-4311 branch 2 times, most recently from 1374dd0 to 318296e Compare January 24, 2019 22:25
Comment thread lib/classes/Variables.js Outdated
_.assign({ name: 'stage' }, provider.getStageSourceValue()),
_.assign({ name: 'profile' }, {
value: this.service.provider.profile,
path: 'serverless.service.provider.profile'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And test will be green!

Suggested change
path: 'serverless.service.provider.profile'
path: 'serverless.service.provider.profile',

j0k3r
j0k3r previously approved these changes Jan 25, 2019
pmuens
pmuens previously approved these changes Jan 25, 2019

@pmuens pmuens left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good from a code perspective 👍

I read through the comments re: breaking changes, but it looks like this is just an addition, so we should be fine here.

I'm not sure how important this PR is. We could merge it right away but I'd love to have a unit test covering this (won't "Request changes") to not block here...

(Or is this already covered by a test 🤔...)

@erikerikson

Copy link
Copy Markdown
Contributor

Agreed, the switch to be additive rather than replacing avoidsthis being a breaking change except in extreme circumstances that I think we accept.

Agreed there's a need for tests. Something like a variable resolving to a valid value then being used by an SSM, S3, whatever variable which will fail but we can catch that expected failure and ensure the profile resolved properly.

@erikerikson

Copy link
Copy Markdown
Contributor

Otherwise, this is a really nice change. Lifting the limitation on profile is super useful and increases the consistency for users. Great work @dschep!

@dschep
dschep dismissed stale reviews from pmuens and j0k3r via 92f4f67 January 25, 2019 16:37
@dschep

dschep commented Jan 25, 2019

Copy link
Copy Markdown
Contributor Author

Note, the test coverage switches from setting the option to setting the config. AFAIK variables in options aren't actually a supported (or documented) feature of sls (and was explicitly not implemented for this profile change)

@pmuens pmuens left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thanks for fixing the tests @dschep 👍

LGTM :shipit:

@dschep
dschep merged commit 03d8ceb into master Jan 28, 2019
@dschep
dschep deleted the fix-sls-4311 branch January 28, 2019 15:10
@dschep dschep added this to the 1.36.4 milestone Feb 5, 2019
@shortjared shortjared added the bug label Feb 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ssm inclusions fail

5 participants