我一直在部署一个名为 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'
现在我需要创建多个文件夹,其中每个文件夹都有一个 index.js 和云构建文件(所有文件夹都在一个 github 存储库中)。 但 cloudbuild.yaml 期望 index.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
您将找到更多信息 here .
关于node.js - 使用 cloudbuild.yaml 部署 Google Cloud 函数 (Node JS) 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57994924/