cloud-functions-emulator
cloud-functions-emulator copied to clipboard
Make the deployment optimistic about unimplemented flags
Hi,
I was referred by @hvarra on the slack channel ( https://googlecloud-community.slack.com/archives/C1D2F6GRF/p1519242426000234 ).
The current emulator rejects deployments with flags that are not yet supported. For example, deploying with the flag --memory
will fail.
We have some deployment scripts and we want to easily use them to deploy into the emulator. For example, we want to call something like FUNCTIONS_DEPLOYMENT_TARGET=emulator deployment_script.sh
. The script should obviously notice the environment variable and call functions deploy ...
instead of gcloud beta functions deploy ...
. We don't want the script to start check each flag, whether it is implemented by the emulator or not.
The emulator should write a warning like "The --memory flag is not implemented yet, ignoring flag" and continue with the deployments. Another possibility is to add a flag like "--optimistic", and only if this flag is given then unknown flags will be ignored.
Thanks, Oren
I'd love to work on this. What would the best approach be? Catch all for all unknown options? Only the ones that are known from gcloud beta functions
sub-commands, but currently not implemented in the emulator? Something else?
Is this something that's interesting, or should we close the issue?
/cc @jmdobry
Well, another possibility is to make the deployment really really fast, then you don't need the emulator at all 😉 . Actually this is not such a bad option. I could write a function that reads some string from a DB, then executes it as code using require-from-string. This is not very efficient in production and won't work if you add dependencies to your package.json, but it will make development faster.