Closed sgulics closed 6 years ago
Thank you, @sgulics, but couldn't you just use the shell features? I mean you can achieve the same thing with just node bin/doSomething.js && node bin/doSomethingElse.js && etc.
. I'm sorry, but I am not very keen to add a feature for something that can be achieved at a lower level.
Hi @mvila, thanks for taking a look and I understand your reasoning. I forked it to use arrays because in the current project I am working on we have 5 scripts that get run on deployment. We thought that the array made it look cleaner than chaining the commands together with &&. Also, some of the scripts are relatively complex, so if something goes wrong, we know which script failed.
Here is an example of what our current configuration looks like:
deploy:deploy:
- REGION=${opt:region, self:provider.region} STACK_NAME=${self:custom.stackName} node bin/export_cf_output.js
- "ES_HOST=${self:custom.elasticSearch.environment.ES_HOST} \
ES_INDEX_NAME=${self:custom.elasticSearch.environment.ES_INDEX_NAME} \
node migrations/elasticsearch/index.js"
- "source .serverless/cf_output_variables && LAMBDA_ARN=$CF_ALambdaFunctionQualifiedArn \
node bin/add_lambda_permission.js"
- "source .serverless/cf_output_variables && STAGE=${self:custom.stage} \
VALIDATION_LAMBDA_ARN=$CF_AnotherLambdaFunctionQualifiedArn \
BUCKET_NAME=${self:custom.templates.bucketName} node bin/deploy_templates.js"
- echo Finished deploying ${self:service} service!
I am sorry, but I really think that your issue should be solved in another way. To make things cleaner, maybe you should put everything in a simple bash script.
I added the ability to add an array of commands to a hook: