<i id='6BhrC'><tr id='6BhrC'><dt id='6BhrC'><q id='6BhrC'><span id='6BhrC'><b id='6BhrC'><form id='6BhrC'><ins id='6BhrC'></ins><ul id='6BhrC'></ul><sub id='6BhrC'></sub></form><legend id='6BhrC'></legend><bdo id='6BhrC'><pre id='6BhrC'><center id='6BhrC'></center></pre></bdo></b><th id='6BhrC'></th></span></q></dt></tr></i><div id='6BhrC'><tfoot id='6BhrC'></tfoot><dl id='6BhrC'><fieldset id='6BhrC'></fieldset></dl></div>

  1. <tfoot id='6BhrC'></tfoot>
  2. <legend id='6BhrC'><style id='6BhrC'><dir id='6BhrC'><q id='6BhrC'></q></dir></style></legend>

  3. <small id='6BhrC'></small><noframes id='6BhrC'>

      <bdo id='6BhrC'></bdo><ul id='6BhrC'></ul>

      在 Google Build 期间在 app.yaml 文件中添加环境变量

      时间:2023-09-13

      <legend id='vFzmz'><style id='vFzmz'><dir id='vFzmz'><q id='vFzmz'></q></dir></style></legend>

      1. <i id='vFzmz'><tr id='vFzmz'><dt id='vFzmz'><q id='vFzmz'><span id='vFzmz'><b id='vFzmz'><form id='vFzmz'><ins id='vFzmz'></ins><ul id='vFzmz'></ul><sub id='vFzmz'></sub></form><legend id='vFzmz'></legend><bdo id='vFzmz'><pre id='vFzmz'><center id='vFzmz'></center></pre></bdo></b><th id='vFzmz'></th></span></q></dt></tr></i><div id='vFzmz'><tfoot id='vFzmz'></tfoot><dl id='vFzmz'><fieldset id='vFzmz'></fieldset></dl></div>

        <small id='vFzmz'></small><noframes id='vFzmz'>

          <tbody id='vFzmz'></tbody>
        • <bdo id='vFzmz'></bdo><ul id='vFzmz'></ul>

                <tfoot id='vFzmz'></tfoot>
                本文介绍了在 Google Build 期间在 app.yaml 文件中添加环境变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                我正在使用带有 cloudbuild.yaml 的 Google Cloud Build 来下载一个 app.yaml 文件,其中包含我的基于 Python 的环境变量应用程序.初始部署使用的app.yaml版本不包含用于安全保护的环境变量.

                I'm using Google Cloud Build with cloudbuild.yaml to download an app.yaml file that includes environment variables for my Python based app. The app.yaml version used for the initial deployment does not contain the environment variables for security protection.

                但是,这似乎不起作用,并且没有检测到环境变量 - 因为 app.yaml 似乎没有被覆盖.

                However, it seems this isn't working and the environment variables aren't being detected - as the app.yaml does not seem to be overwritten.

                以下是我的cloudbuild.yaml配置:

                steps:
                 - name: gcr.io/cloud-builders/gsutil
                args:
                  [
                    "cp",
                    "gs://<path to bucket>/app.yaml",
                    "app.yaml",
                  ]
                

                我了解 App Engine 上的应用程序的入口点是通过 app.yaml 但我认为如果包含 cloudBuild.yaml,这将首先被调用,然后是 app.yaml.

                I understand the entrypoint for an app on App Engine is through app.yaml but I thought that if cloudBuild.yaml is included, this would be called first and then app.yaml.

                如果这不正确,我还能如何将环境变量附加到我的 app.yaml 文件中?

                If this isn't correct how else can I append environment variables to my app.yaml file?

                谢谢!

                推荐答案

                当你运行 gcloud app deploy 时,部署过程不会使用 cloudbuild.yaml 文件考虑并将您的应用与您的 unpopulated app.yaml 文件一起部署.

                When you run gcloud app deploy, the deployment process won't take the cloudbuild.yaml file into account and will deploy your app along with your unpopulated app.yaml file.

                要运行自定义构建步骤,您需要像之前一样创建一个 cloudbuild.yaml 文件,定义您的自定义构建步骤,然后添加一个构建步骤来运行部署命令.应该是这样的:

                To run a custom build step, you'll need to create a cloudbuild.yaml file as you did, define your custom build step and then add a build step to run the deploy command. That'd be something like this:

                steps:
                 - name: gcr.io/cloud-builders/gsutil
                   args:
                   [
                    "cp",
                    "gs://<path to bucket>/app.yaml",
                    "app.yaml",
                   ]
                 - name: 'gcr.io/cloud-builders/gcloud'
                   args: ['app', 'deploy']
                

                然后,您将通过发出以下命令来运行构建(在您运行 gcloud app deploy 的同一目录中):

                You'll then run the build by issuing the following command (in the same directory where you'd have run the gcloud app deploy one):

                gcloud builds submit --config cloudbuild.yaml .
                

                这将:

                • 将当前目录上传到 Cloud Build 实例
                • 在 CB 实例的该目录中运行 gsutil 命令以检索填充了您的环境变量的 app.yaml 文件
                • 将您的代码从 Cloud Build 实例部署到 App Engine

                这篇关于在 Google Build 期间在 app.yaml 文件中添加环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:如何为 Google App Engine 应用程序编写 `app.yaml` 文件 下一篇:pyyaml:不带标签的倾销

                相关文章

                最新文章

                1. <legend id='B32B8'><style id='B32B8'><dir id='B32B8'><q id='B32B8'></q></dir></style></legend>

                      <bdo id='B32B8'></bdo><ul id='B32B8'></ul>
                  1. <i id='B32B8'><tr id='B32B8'><dt id='B32B8'><q id='B32B8'><span id='B32B8'><b id='B32B8'><form id='B32B8'><ins id='B32B8'></ins><ul id='B32B8'></ul><sub id='B32B8'></sub></form><legend id='B32B8'></legend><bdo id='B32B8'><pre id='B32B8'><center id='B32B8'></center></pre></bdo></b><th id='B32B8'></th></span></q></dt></tr></i><div id='B32B8'><tfoot id='B32B8'></tfoot><dl id='B32B8'><fieldset id='B32B8'></fieldset></dl></div>

                    <small id='B32B8'></small><noframes id='B32B8'>

                  2. <tfoot id='B32B8'></tfoot>