Open nspeet opened 4 years ago
Found this: @deemetree-at-satelligence said you could use sls hooks using this plugin: https://www.npmjs.com/package/serverless-plugin-scripts
YAML FILE
service: YOUR-SERVICE-NAME
custom:
...
# this comes from https://www.npmjs.com/package/serverless-plugin-scripts
scripts:
commands:
make-public: gcloud functions add-iam-policy-binding ${self:service}-${self:provider.stage}-${opt:function, "YOUR-DEFAULT-FUNCTION-NAME"} --member="allUsers" --role="roles/cloudfunctions.invoker" --project=${self:provider.project} --region=${self:provider.region} | xargs echo
hooks:
'after:deploy:deploy': npx sls make-public --function=YOUR-FUNCTION-NAME
...
This hook automatically makes the specified google functions public after deploy and otherwise you can run sls make-public --function=
AWS has hooks such as this.hooks = { "aws:deploy:finalize:cleanup": this.afterDeploy.bind(this), };
Are there similar hooks for GCP cloud function deploys? If not, how can one create a hook for 'after deploy' of a cloud function?