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

标签 node.js google-cloud-functions google-cloud-build

我一直在部署一个名为 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/

相关文章:

google-cloud-run - GCP 部署错误 : Creating Revision interrupted

node.js - GCS 设置更改后,Cloud Build 不断失败

docker - 为什么我无法使用 Google Cloud Build 提取 Google ArtifactRegistry Docker 镜像?

node.js - Express gateway 如何忽略路径但使用 url 的其余部分

javascript - 如何在nestjs中执行嵌套路由?

javascript - 从 iOS 应用程序调用该函数时,Firebase HTTP 云函数给出 401 错误

node.js - 云函数: No document found

javascript - 当用户与站点交互时禁用自动滚动 'scrollToBottom' 功能

javascript - C++ node.js 模块。 cout 不工作?

firebase - 从 Google Cloud Storage 获取更短的文件 URL(使用 Firebase Cloud Functions)