将firebase私有密钥json文件部署到应用程序引擎

发布于 2025-02-04 15:41:11 字数 425 浏览 1 评论 0原文

我有一个通过Gitlab CI部署到Google Cloud App Engine的App Engine Project。该项目使用Firebase管理员。要授权应用程序一个名为private-key.json包含凭据的秘密文件。

要处理此文件,我将其存储在gitlab ci文件中,然后将其复制到构建过程中的工作目录。在部署步骤中,我将部署到App Engine:

gcloud --quiet --project "$PROJECT_ID_PRODUCTION" app deploy app.yaml --version "$CI_COMMIT_SHORT_SHA"  --no-promote

浏览App Engine版本上的源时,该文件丢失了。所有其他文件都在那里。

我找不到导致这种行为的任何有记录的规则。我缺少什么导致文件不部署?

I have a App Engine project I am deploying through Gitlab CI to Google Cloud App Engine. The project uses Firebase Admin. To authorize the application a secret file called private-key.json containing the credentials is required.

To handle this file I have stored it in a Gitlab CI file secret and copy it to the working directory during build. In the deployment step I deploy to App Engine with:

gcloud --quiet --project "$PROJECT_ID_PRODUCTION" app deploy app.yaml --version "$CI_COMMIT_SHORT_SHA"  --no-promote

When browsing the source on the App Engine version the file is missing. All other files are there.

I was not able to find any documented rule causing this behavior. What am I missing that causes the file not to be deployed?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

执手闯天涯 2025-02-11 15:41:13

首先:应用程序引擎的应用程序部署将自动具有存储在其ENV变量中的相关Google凭据,以便能够使用同一项目上的任何Google Cloud Services进行身份验证。因此,仪式服务将被认证,默认情况下通常可以访问。

现在,如果您需要将私钥传递给实例,请确保它确实存储在已部署的存储库中(例如在Angular上等...)。

另外,请确保您的.cloudignore文件不包含您的私钥!

first: an app deployer to App Engine will automatically have the relevant Google credentials stored in its Env Variables to be able to authenticate with any Google Cloud Services on the same project. So firebase services will be authenticated and normally accessible by default.

Now, if you need to pass a private key to your instance, make sure that it is indeed stored in the repo being deployed (for example on Angular it would be the distin Next maybe build, etc...).

Also, make sure that your .cloudignore file does not contain your private key!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文