You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Allow commands to define before/after command dependencies that should run as well #2659
Some commands (e.g. Deployment) depend on other steps of the process (e.g. packaging) that should be handled in a separate command, so they can be exposed to users as well. We need a clean way for command authors to define this dependency and then for the Plugin System to actually execute this command beforehand or after.
To implement this we need to extend the Plugin System to allow for dependent commands to run before or after the command the user entered. The command will execute its own lifecycle events and will have the same options that are available to the command the user entered. This might lead to issues with overlapping command line options which we can address in a future update by namespacing options (if necessary, doubt it will be at this point).
Config Example
To define dependencies to other commands you can add a dependencies config parameter that can have before and after sections to your command config. Before/After can take strings or arrays of strings in case there are several dependencies. Those dependent commands will then be executed.
We were also thinking about exposing an API to invoke function programmatically. This benefit would be that you could start using Serverless as a toolbox to build and run your own flows. Compared to just before/after it would be more flexible as you could defined different paths based on previous commands.
The benefit of having before and after is the static nature. The framework can provide the CLI with more information on which steps actually will run. Did I miss other benefits?
In both cases we clearly have the opportunity to modularize the code even further. Right now there are some functions re-used by multiple plugins which simply could be a command invoked e.g. serverless info. Also as @johncmckim pointed out both ways we can create a build/package command.
@nikgraf a formal plugin API would be great (with documentation!). Right now we're hanging so much stuff off serverless.service. To work out what we need we're looking at the serverless source and basing plugins on existing plugins.
An option to trigger other plugins would be helpful. In relation to build/package this would allow deploy to trigger a build if required.
Activity
austencollins commentedon Nov 13, 2016
Please don't move forward with this until we've had some time to discuss.
flomotlik commentedon Nov 16, 2016
Yup, please share your thoughts in this issue so we can start planning this.
On 14 November 2016 at 00:57:20, Austen ([email protected]) wrote:
Please don't move forward with this until we've had some time to discuss.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
pmuens commentedon Nov 22, 2016
Would like to continue the discussion here.
@ac360 can you share your thoghts?
/cc @nikgraf @mthenw @eahefnawy
nikgraf commentedon Nov 23, 2016
We were also thinking about exposing an API to invoke function programmatically. This benefit would be that you could start using Serverless as a toolbox to build and run your own flows. Compared to just before/after it would be more flexible as you could defined different paths based on previous commands.
The benefit of having before and after is the static nature. The framework can provide the CLI with more information on which steps actually will run. Did I miss other benefits?
In both cases we clearly have the opportunity to modularize the code even further. Right now there are some functions re-used by multiple plugins which simply could be a command invoked e.g.
serverless info. Also as @johncmckim pointed out both ways we can create abuild/packagecommand.Thoughts? @ac360 @johncmckim @eahefnawy @pmuens
johncmckim commentedon Nov 24, 2016
@nikgraf a formal plugin API would be great (with documentation!). Right now we're hanging so much stuff off
serverless.service. To work out what we need we're looking at theserverlesssource and basing plugins on existing plugins.An option to trigger other plugins would be helpful. In relation to
build/packagethis would allow deploy to trigger a build if required.pmuens commentedon May 19, 2017
Closing this to keep the issue count low. We'll revisit this when working on upcoming Serverless versions.