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
Conversation
Happy Birthday Maciej!!! |
Looks like it's failing on prettier but works for me locally
:thonk: |
Oh, and thanks @dschep :D |
try..
|
@dschep I fixed it. Thanks! |
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.
@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) { |
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.
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
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 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'); |
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.
@medikoo I'm not super happy about that assertion so please let me know if there are better ways to check 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.
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)
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.
Done!
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.
Thank you @mthenw! It sneaks with last boarding call into v1.50.0 :)
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 changesValidate via
npm test
Validate via
npm run lint-updated
Note: Some reported issues can be automatically fixed by running
npm run lint:fix
Validate via
npm run prettier-check-updated
Note: All reported issues can be automatically fixed by running
npm run prettify-updated
Is this ready for review?: YES
Is it a breaking change?: NO