gcloud函数deploy忽略点文件



我的项目文件夹如下:

.
├── main.py
├── .keys

main.py打开并读取.keys的内容。

我上传这个项目到GCP功能如下:

gcloud functions deploy my-function --entry-point func --project my-project --runtime python37 --timeout 30 --trigger-topic my-topic

我的.gcloudignore是默认的:

# This file specifies files that are *not* uploaded to Google Cloud
# using gcloud. It follows the same syntax as .gitignore, with the addition of
# "#!include" directives (which insert the entries of the given .gitignore-style
# file at that point).
#
# For more information, run:
#   $ gcloud topic gcloudignore
#
.gcloudignore
# If you would like to upload your .git directory, .gitignore file or files
# from your .gitignore file, remove the corresponding line
# below:
.git
.gitignore
node_modules
#!include:.gitignore

当我这样做时,.keys不会上传到我的GCP函数,因此代码无法从中读取。

如果.keys也在.gitignore中,gcloud将不会上传。您需要从.gcloudignore中删除#!include:.gitignore或从.gitignore中删除.keys

最新更新