【发布时间】:2021-03-13 21:53:25
【问题描述】:
我在使用 Cloud Build Trigger 将 node.js (Angular) 应用程序从 Bitbucket 存储库部署到 Firebase 时遇到问题。 我执行了本文中的步骤 - https://cloud.google.com/build/docs/deploying-builds/deploy-firebase
- 打开了必要的 API,
- 服务帐号拥有所有必需的权限,
- Firebase 社区构建器已部署并在 Container Registry 中可见,
- Cloudbuild.json 文件被添加到存储库,
- Cloud Build Trigger 已创建,它指向我的存储库的一个特定分支。
问题是在运行 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 配置中指向该路径的任何可能性。
【问题讨论】:
-
你能分享你的 cloudbuild.json,至少是失败的部分吗?我可以帮你调试。此外,您是否尝试使用 CLI 运行 Cloud Build?来自哪个目录?
-
我已经编辑了我的帖子。在推送 firebase 社区构建器时,我从 CLI 运行 Cloud Build。我是从“apps/firebase”路径完成的。在这种情况下,firebase 社区构建器的提交没有任何问题,并且它在我的 Container Registry 项目中可见。
标签: firebase google-cloud-platform continuous-deployment google-cloud-build