Cloud Build 触发器 - 不在 Firebase 应用目录错误中

Cloud Build Trigger - Not in Firebase app directory error

我在使用 Cloud Build Trigger 将 node.js (Angular) 应用程序从 Bitbucket 存储库部署到 Firebase 时遇到问题。 我执行了本文中的步骤 - https://cloud.google.com/build/docs/deploying-builds/deploy-firebase

问题是在 运行 Cloud Build Trigger 之后我收到以下错误:“错误:不在 Firebase 应用程序目录中(无法找到 firebase.json)”

出现这种错误的原因可能是什么?是否可以指向存储库中 firebase 应用程序和 firebase.json 文件的触发器?

编辑:
我的 cloudbuild.json 文件很简单:

{
  "steps": [
   {
      "name": "gcr.io/PROJECT_NAME/firebase",
      "args": [
         "deploy",
         "--project",
         "PROJECT_NAME",
         "--only",
         "functions"
       ]
  }
  ]
}

Cloud Build 触发器历史记录:

  starting build "build_id"

FETCHSOURCE
Initialized empty Git repository in /workspace/.git/
From https://source.developers.google.com/p/link
 * branch            branch_id -> FETCH_HEAD
HEAD is now at d8bc2f1 Add cloudbuild.json file
BUILD
Pulling image: gcr.io/PROJECT/firebase
Using default tag: latest
latest: Pulling PROJECT/firebase
1e987daa2432: Already exists
a0edb687a3da: Already exists
6891892cc2ec: Already exists
684eb726ddc5: Already exists
b0af097f0da6: Already exists
154aee36a7da: Already exists
37e5835696f7: Pulling fs layer
62eb6e670f1d: Pulling fs layer
47e62615d9f9: Pulling fs layer
428cea824ccd: Pulling fs layer
765a2c722bf9: Pulling fs layer
b3f5d0a285e3: Pulling fs layer
428cea824ccd: Waiting
765a2c722bf9: Waiting
b3f5d0a285e3: Waiting
47e62615d9f9: Verifying Checksum
47e62615d9f9: Download complete
62eb6e670f1d: Verifying Checksum
62eb6e670f1d: Download complete
765a2c722bf9: Verifying Checksum
765a2c722bf9: Download complete
b3f5d0a285e3: Verifying Checksum
b3f5d0a285e3: Download complete
37e5835696f7: Verifying Checksum
37e5835696f7: Download complete
428cea824ccd: Verifying Checksum
428cea824ccd: Download complete
37e5835696f7: Pull complete
62eb6e670f1d: Pull complete
47e62615d9f9: Pull complete
428cea824ccd: Pull complete
765a2c722bf9: Pull complete
b3f5d0a285e3: Pull complete
Digest: sha256:4b6b7214d6344c8247130bf3f5443a2851e39aed3ececb32dfb2cc25a5c07e44
Status: Downloaded newer image for gcr.io/PROJECT/firebase:latest
gcr.io/PROJECT/firebase:latest

Error: Not in a Firebase app directory (could not locate firebase.json)
ERROR
ERROR: build step 0 "gcr.io/PROJECT/firebase" failed: step exited with non-zero status: 1

Firebase.json 文件放置在以下路径的存储库中:/apps/firebase/firebase.json 我看不到在 Cloud Build Trigger 配置中指向该路径的任何可能性。

我很确定您在 运行 命令时不在正确的目录中。要检查这一点,您可以添加此步骤

{
  "steps": [
   {
      "name": "gcr.io/cloud-builders/gcloud",
      "entrypoint":"ls"
      "args": ["-la"]
  }
  ]
}

如果您不在正确的目录中,而您需要在 ./app/firebase 到 运行 部署中,您可以在步骤中添加此参数

{
  "steps": [
   {
      "name": "gcr.io/PROJECT_NAME/firebase",
      "dir": "app/firebase",
      "args": [
         "deploy",
         "--project",
         "PROJECT_NAME",
         "--only",
         "functions"
       ]
  }
  ]
}

让我知道是否更好