我在 GCP 项目中有一个存储库,其中包含我想要在 Firebase 中作为托管应用程序发布的 PWA。我想设置一个触发器,以便每当在分支中完成推送时,它都会在 Firebase 中部署 de PWA。我已按照 GCP 文档中的步骤操作部署 Firebase https://cloud.google.com/cloud-build/docs/deploying-builds/deploy-firebase但我总是收到授权错误
无法获取 Firebase 项目 ghe-dev-repositories-170-920df。请确保该项目存在并且您的帐户有访问该项目的权限。
我已多次检查是否已启用所有必需的 API,并且 @cloudbuild.gserviceaccount.com 帐户是否具有所需的角色。
我注意到,在创建 Firebase 项目时,Firebase 为该项目提供了一个与 GCP 项目不同的 Id。下面我粘贴了cloudbuild.yaml
steps:
- name: node
entrypoint: yarn
args: ["install"]
- name: gcr.io/cloud-builders/gsutil
args: ['cp', '${_APP_ENV_PATH}', 'packages/app/.env']
- name: node
entrypoint: yarn
args: ["build"]
- name: 'gcr.io/${_GCP_PROJECT_ID}/firebase'
args: ['deploy', '--project=${_TARGET_PROJECT_ID}', '--only=hosting:${_TARGET_ENVIRONMENT}']
timeout: "1600s"
有什么线索吗?
你跑了吗firebase login:ci
并设置环境变量FIREBASE_TOKEN
?
See:
- https://github.com/firebase/firebase-tools#using-with-ci-systems https://github.com/firebase/firebase-tools#using-with-ci-systems
- Google 云构建不替换 firebase 令牌的环境变量 https://stackoverflow.com/questions/55754674/google-cloud-built-not-substituting-environment-variable-for-firebase-token/55762821#55762821
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)