无法从GCP Cloud Build部署到Firebase托管

时间:2020-06-27 08:06:25

标签: firebase google-cloud-platform firebase-hosting google-cloud-build

我在一个GCP项目中有一个存储库,其中包含要在Firebase中作为托管应用发布的PWA。我想设置一个触发器,以便每当在分支中完成一次推送时,它就会在Firebase中部署de PWA。我已经按照GCP文档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"

有任何线索吗?

1 个答案:

答案 0 :(得分:0)

您是否运行过firebase login:ci并设置了环境变量FIREBASE_TOKEN

请参阅: