Skip to content

Move packaging to framework level - #3496

Merged
eahefnawy merged 5 commits into
serverless:masterfrom
HyperBrain:move-packaging-to-framework-level
Apr 21, 2017
Merged

eahefnawy merged 5 commits into
serverless:masterfrom
HyperBrain:move-packaging-to-framework-level

Conversation

@HyperBrain

@HyperBrain HyperBrain commented Apr 20, 2017 •

Copy link
Copy Markdown
Contributor

What did you implement:

Restores compatibility with provider plugins. See #3344

How did you implement it:

The packaging is now moved to the framework level. The global package plugin overwrites the package:createDeploymentArtifacts.

How can we verify it:

Use "serverless deploy" with different plugins (including AWS). The command should work as before.
Additionally check if deploy and package still work for the AWS plugin with a given package option.

Todos:

  • Write tests
  • 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

@pmuens pmuens added this to the 1.12 milestone Apr 20, 2017
@HyperBrain

Copy link
Copy Markdown
Contributor Author

@pmuens Could you do a check if this PR still works with the AWS deploy?

@pmuens

pmuens commented Apr 20, 2017

Copy link
Copy Markdown
Contributor

@HyperBrain Just did a quick deploy to AWS. Everything fine for the AWS plugin.

Also biiiiig +1 for moving it to the Framework level since packaging is not AWS related. This change was also on my todo list, so happy to see that you're already working on it here 👍 .

@jthomas

jthomas commented Apr 20, 2017

Copy link
Copy Markdown
Contributor

Quick test with the OpenWhisk Node.js template and... it works again!

I'll do a more comprehensive test tomorrow to ensure everything else is working.

@pmuens

pmuens commented Apr 20, 2017

Copy link
Copy Markdown
Contributor

Just did a quick test with the Google Cloud Functions plugin. Works great. Thanks for the fix @HyperBrain 👍

Frank Schmid added 2 commits April 20, 2017 17:49
3rd party plugins now can access it and trigger a single function package which was restricted to AWS before.
@HyperBrain HyperBrain changed the title Move packaging to framework level [WIP] Move packaging to framework level Apr 20, 2017
@HyperBrain

Copy link
Copy Markdown
Contributor Author

@jthomas @pmuens @eahefnawy From my side the PR is finalized now. Feel free to merge after you did the remaining tests (especially with the provider plugins).

const zipFileName = `${this.serverless.service.service}.zip`;

return this.zipDirectory(exclude, include, zipFileName);
return this.zipDirectory(exclude, include, zipFileName).then(filePath => {

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.

if your promises are bluebird, you can use .tap

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

Just did another test today.

Deployment with the Google Cloud Functions provider plugin works great!

Deployment and packaging (with service and provider level packaging) also works great!

This PR is GTM from my side :shipit:

Just added some comments about outsourcing the naming. Not sure if changing it is worth the trouble.

/cc @eahefnawy @jthomas

const exclude = this.getExcludes();
const include = this.getIncludes();
const zipFileName = this.provider.naming.getServiceArtifactName();
const zipFileName = `${this.serverless.service.service}.zip`;

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.

Maybe overkill but should we move this into a provider.naming function as well?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This was in the naming namespace. But the problem is, that the topmost package command does not have knowledge nor access to the current provider. That's why we changed it here.
A possible improvement would be to create a provider-independent naming module that can be accessed here - but that will only increase debt as long as only one value/function is stored in there.

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.

Thanks for the explanation. Yes, I agree. A provider independent naming module would increase tech-debt and might be a little bit overkill for now. But something we should keep in mind if we see other patterns where we could utilize this again.

const include = this.getIncludes(funcPackageConfig.include);
const zipFileName = this.provider.naming.getFunctionArtifactName(functionName);
return this.zipDirectory(exclude, include, zipFileName);
const zipFileName = `${functionName}.zip`;

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.

Same here. Overkill, but maybe a provider.naming is a good place to store this value.

@HyperBrain

Copy link
Copy Markdown
Contributor Author

@jthomas Could you comment here as soon as you did your final tests?

@eahefnawy

Copy link
Copy Markdown
Contributor

Gonna merge this since it fixes the issue. Any further issues reported by @jthomas would be fixed in later PRs (if any).

@jthomas please let us know whenever you have updates 🙌

As always, thanks a lot @HyperBrain 😊 ☺️

@eahefnawy
eahefnawy merged commit 21b6037 into serverless:master Apr 21, 2017
@pmuens
pmuens deleted the move-packaging-to-framework-level branch April 21, 2017 12:06
@jthomas

jthomas commented Apr 21, 2017

Copy link
Copy Markdown
Contributor

No more issues encountered. 🥇
LGTM.

jthomas pushed a commit to serverless/serverless-openwhisk that referenced this pull request Jun 6, 2017
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.

5 participants