Gcloudignore works like gitignore in that you can exclude certain files from uploading to GCF. Sometimes when you have really large projects with lots of generated files, it can be useful to exclude all files except a few.
.gcloudignore
# Ignore everything
# Or /*
*
# Except the Cloud Function files we want to deploy
!/package.json
!/index.js
The following gcloudignore file gives us: File index.js or function.js that is expected to define function doesn't exist in the root directory.
meaning index.js is ignored and can not be read.
However the following ignore file syntax works just fine to deploy:
# Ignore everything
/[!.]*
/.?*
# Except the Cloud Function files we want to deploy
!/package.json
!/index.js
I tried peering into the gcloud program code, but I was wondering if anyone knows why this is the case?