如何覆盖GOOGLE_ENTRYPOINT为我的谷歌功能?



我正在使用maven作为项目构建工具在Google Cloud中开发无服务器应用程序。我的项目有多模块架构:

root
- post-function
- repost-function-1
- repost-function-2
- repost-function-3

因此,我需要为每个模块提供不同的目标路径,以便分别部署它们。虽然我觉得没必要这么做。我通过从root模块执行以下命令来部署我的功能:

gcloud functions deploy post-function --entry-point io.micronaut.gcp.function.http.HttpFunction --runtime java11 --trigger-http

显然,它失败了,因为我的根模块的target不知道孩子的targets。因此,我尝试重写GOOGLE_ENTRYPOINT以使用java -jar post-function/target/post-function-0.1.0.jar而不是默认的自动生成启动脚本。然而,我有以下错误:

ERROR: (gcloud.functions.deploy) argument——set-build-env-vars: GOOGLE_ENTRYPOINT保留给GCF部署内部使用,不能使用。

因此,我需要另一种方法来指定应该为我的项目中的每个函数使用哪个目标。

我的建议是使用bash脚本逐一部署所有函数,例如:

gcloud functions deploy post-function --trigger-http &
gcloud functions deploy repost-function-1 --trigger-http &
gcloud functions deploy repost-function-2 --trigger-http &
gcloud functions deploy repost-function-3 --trigger-http

最新更新