使用 cloudbuild.yaml 部署 Google Cloud 函数 (Node JS) 时出错



我一直在部署一个名为athenticationProcessing((的谷歌云函数(Node js( 使用以下命令:

gcloud functions deploy athenticationProcessing --runtime nodejs8 --trigger-topic Authentication

到目前为止,它工作正常。
现在我已经启动了cloudbuild,我使用了以下脚本,该脚本也运行良好:

steps:
- name: 'gcr.io/cloud-builders/gcloud'
args:
- functions
- deploy
- athenticationProcessing
- '--trigger-topic'
- Authentication
- '--runtime'
- nodejs8
- '--timeout=540'

现在我需要创建多个文件夹,其中每个文件夹都有一个索引.js和云构建文件(所有文件夹都在一个 github 存储库中(。 但是 cloudbuild.yaml 希望索引.js位于存储库的根文件夹中。

我可以添加一些属性来使 cloudbuild.yaml 知道我的索引文件的确切位置而不是猜测默认位置?

您可以使用每个步骤中的dir字段来指定执行部署命令的特定文件夹,例如:

steps:
- name: 'gcr.io/cloud-builders/gcloud'
args:
- functions
- deploy
- athenticationProcessing
...
dir: folder/foo
- name: 'gcr.io/cloud-builders/gcloud'
args:
- functions
- deploy
- OTHER_FUNCTION_NAME
...
dir: folder/bar

您可以在此处找到更多信息。

最新更新