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

Fix deploy command if package.individually set on a function-level #6537

Merged
merged 5 commits into from Aug 14, 2019

Conversation

mthenw
Copy link
Contributor

@mthenw mthenw commented Aug 13, 2019

What did you implement:

Closes #6120

The issue was that sls deploy didn't work if package.individually was set on a function-level. According to the docs, it should work but looks like it has never worked.

How did you implement it:

I simplified & cleaned up the validation logic that runs before deployment.

How can we verify it:

I gave two examples in the comment: #6120 (comment). Both works now.

Todos:

Note: Run npm run test-ci to run all validation checks on proposed changes

  • Write tests and confirm existing functionality is not broken.
    Validate via npm test
  • Write documentation
  • Ensure there are no lint errors.
    Validate via npm run lint-updated
    Note: Some reported issues can be automatically fixed by running npm run lint:fix
  • Ensure introduced changes match Prettier formatting.
    Validate via npm run prettier-check-updated
    Note: All reported issues can be automatically fixed by running npm run prettify-updated
  • 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

@dschep
Copy link
Contributor

dschep commented Aug 13, 2019

Happy Birthday Maciej!!!

dschep
dschep previously approved these changes Aug 13, 2019
@mthenw
Copy link
Contributor Author

mthenw commented Aug 13, 2019

Looks like it's failing on prettier but works for me locally

➜  serverless (master) ✔ npm run prettier-check-updated

> serverless@1.49.0 prettier-check-updated /Users/maciej.winnicki/Projects/serverless
> pipe-git-updated --ext=css --ext=html --ext=js --ext=json --ext=md --ext=yaml --ext=yml -- prettier -c

:thonk:

@mthenw
Copy link
Contributor Author

mthenw commented Aug 13, 2019

Oh, and thanks @dschep :D

@dschep
Copy link
Contributor

dschep commented Aug 13, 2019

try..

rm -rf package-lock.json node_modules
npm i
npm run prettify

@mthenw
Copy link
Contributor Author

mthenw commented Aug 13, 2019

@dschep I fixed it. Thanks!

dschep
dschep previously approved these changes Aug 13, 2019
@dschep dschep requested a review from pmuens August 13, 2019 19:31
Copy link
Contributor

@medikoo medikoo left a comment

Choose a reason for hiding this comment

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

@mthenw looks as notable fix :)

Just one minor remark, and I think it'll be good to accompany this with some test, to avoid eventual regression

} else if (this.serverless.service.package.artifact) {
// Use service-level artifact
artifactFileName = artifactFilePath = this.serverless.service.package.artifact;
} else if (individually) {
Copy link
Contributor

Choose a reason for hiding this comment

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

If I read correctly, it'll change behavior for configurations in which both package.individually and package.artifact is set.

Such configuration is obviously contradictory, still currentlypackage.individually takes precedence over package.artifact, and effect of this PR would be that this precedence will be reverted.

I think it'll be better if we maintain precedence of package.individually

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 catch! Let me fix it.

return awsDeploy.extendedValidate().then(() => {
expect(fileExistsSyncStub.calledTwice).to.equal(true);
expect(readFileSyncStub.calledOnce).to.equal(true);
expect(fileExistsSyncStub.lastCall.args[0]).to.have.string('.serverless/first.zip');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@medikoo I'm not super happy about that assertion so please let me know if there are better ways to check it

Copy link
Contributor

Choose a reason for hiding this comment

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

Probably better would be to just confirm that awsDeploy.extendedValidate doesn't crash with individually set on function level (which I believe will happen on master now)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

Copy link
Contributor

@medikoo medikoo left a comment

Choose a reason for hiding this comment

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

Thank you @mthenw! It sneaks with last boarding call into v1.50.0 :)

@medikoo medikoo added this to the 1.50.0 milestone Aug 14, 2019
@medikoo medikoo merged commit 312b4f5 into serverless:master Aug 14, 2019
@mthenw mthenw deleted the fix-depeloy-individually branch August 14, 2019 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Packaging functions individually causes "no serviceName.zip file found in the package path you provided"
3 participants