Closed triqi closed 6 years ago
Not tested but I think you can do something like that: echo First ; echo Then ; echo Finally
I ended up with a single script for each hook, which in turns execute subsequent scripts. This way allows me to control the execution flow, e.g. sync vs. asycn.
Closing.
I just had the same need and ended up like this:
scripts:
commands:
update-topic-filters: sls invoke local -f configureSubscriptions --path resources/lambdaTopicFilters.json
update-queues: sls invoke local -f updateQueues
hooks:
before:deploy:finalize: sls update-topic-filters && sls update-queues
However, I tried doing this (which I think is a much cleaner approach)
scripts:
commands:
update-topic-filters: sls invoke local -f configureSubscriptions --path resources/lambdaTopicFilters.json
update-queues: sls invoke local -f updateQueues
hooks:
before:deploy:finalize:
- sls update-topic-filters
- sls update-queues
However, this gives me this error
Type Error [ E R R_ I N V A L I D_ A R G_ T Y P E] -----
The "file" argument must be of type string. Received type object
Not sure if it's a limitation of the serverless plugin API or if it could be fixed in the plugin?
It's a deliberate choice for this plugin. I want to keep the API as simple as possible, so arrays of commands are not supported, and you should chain them with ;
or &&
.
This plugin is very useful, and it would be even more so if we are able to execute multiple commands for each serverless hook.