在 Cloud Build 上部署到 AppEngine 失败 -- 但不是在本地

Posted

技术标签:

【中文标题】在 Cloud Build 上部署到 AppEngine 失败 -- 但不是在本地【英文标题】:Deployment to AppEngine fails on Cloud Build -- But not locally 【发布时间】:2021-09-14 17:53:48 【问题描述】:

截至今天早上,我所有的构建管道都开始出现故障。许多管道中的代码都没有改变,cloudbuild.yaml 文件也没有改变。

我有几个 NodeJS 应用程序,它们的 CloudBuild.yaml 文件类似于:

steps:

- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
  entrypoint: 'bash'
  args: ['-c', 'gcloud config set app/cloud_build_timeout 1600']

#Install Dependencies 
- name: node
  entrypoint: npm
  args: ['install']

#Build an optimized version of the website
- name: node
  entrypoint: npm
  args: ['run', 'build']
  env:
  - [LIST OF ENV VARIABLES HERE -- Omitted for the question"

#Deploy to AppEngine using the Branch as the version
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
  entrypoint: 'bash'
  args: ['-c', 'gcloud app deploy $_ENV_YAML']

timeout: '1600s'

options:
  machineType: 'N1_HIGHCPU_8'

从今天早上开始,CloudBuild 似乎在“上传文件”后卡住并最终出错:

    Step #3: Beginning deployment of service [development]...
Step #3: ╔════════════════════════════════════════════════════════════╗
Step #3: ╠═ Uploading 7 files to Google Cloud Storage                ═╣
Step #3: ╚════════════════════════════════════════════════════════════╝
Step #3: File upload done.
Step #3: Updating service [development]...
Step #3: ..................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................failed.
Step #3: ERROR: (gcloud.app.deploy) Error Response: [13] An internal error occurred.

当我打开调试时:

..............................DEBUG: Operation [apps/munch-web/operations/8048d88b-1993-4155-ad6f-9322f88e44f3] complete. Result: 
    "done": true,
    "error": 
        "code": 13,
        "message": "An internal error occurred."
    ,
    "metadata": 
        "@type": "type.googleapis.com/google.appengine.v1.OperationMetadataV1",
        "endTime": "2021-07-02T19:10:58.770Z",
        "insertTime": "2021-07-02T18:55:55.020Z",
        "method": "google.appengine.v1.Versions.CreateVersion",
        "target": "apps/munch-web/services/development/versions/20210702t185547",
        "user": "498370915597@cloudbuild.gserviceaccount.com"
    ,
    "name": "apps/munch-web/operations/8048d88b-1993-4155-ad6f-9322f88e44f3"

failed.
DEBUG: (gcloud.app.deploy) Error Response: [13] An internal error occurred.
Traceback (most recent call last):
  File "/usr/lib/google-cloud-sdk/lib/googlecloudsdk/calliope/cli.py", line 982, in Execute
    resources = calliope_command.Run(cli=self, args=args)
  File "/usr/lib/google-cloud-sdk/lib/googlecloudsdk/calliope/backend.py", line 809, in Run
    resources = command_instance.Run(args)
  File "/usr/lib/google-cloud-sdk/lib/surface/app/deploy.py", line 130, in Run
    use_legacy_apis=args.use_legacy_apis)
  File "/usr/lib/google-cloud-sdk/lib/googlecloudsdk/command_lib/app/deploy_util.py", line 691, in RunDeploy
    service_account=service_account)
  File "/usr/lib/google-cloud-sdk/lib/googlecloudsdk/command_lib/app/deploy_util.py", line 463, in Deploy
    extra_config_settings, service_account)
  File "/usr/lib/google-cloud-sdk/lib/googlecloudsdk/api_lib/app/appengine_api_client.py", line 213, in DeployService
    poller=done_poller)
  File "/usr/lib/google-cloud-sdk/lib/googlecloudsdk/api_lib/app/operations_util.py", line 314, in WaitForOperation
    sleep_ms=retry_interval)
  File "/usr/lib/google-cloud-sdk/lib/googlecloudsdk/api_lib/util/waiter.py", line 264, in WaitFor
    sleep_ms, _StatusUpdate)
  File "/usr/lib/google-cloud-sdk/lib/googlecloudsdk/api_lib/util/waiter.py", line 326, in PollUntilDone
    sleep_ms=sleep_ms)
  File "/usr/lib/google-cloud-sdk/lib/googlecloudsdk/core/util/retry.py", line 243, in RetryOnResult
    if not should_retry(result, state):
  File "/usr/lib/google-cloud-sdk/lib/googlecloudsdk/api_lib/util/waiter.py", line 320, in _IsNotDone
    return not poller.IsDone(operation)
  File "/usr/lib/google-cloud-sdk/lib/googlecloudsdk/api_lib/app/operations_util.py", line 183, in IsDone
    encoding.MessageToPyValue(operation.error)))
googlecloudsdk.api_lib.app.operations_util.OperationError: Error Response: [13] An internal error occurred.
ERROR: (gcloud.app.deploy) Error Response: [13] An internal error occurred.

我似乎无法确定问题出在哪里。疯狂的部分是当我在我的机器上本地运行这个管道时,它部署得很好,对 AppEngine 没有任何问题。

知道我可以从哪里开始进行故障排除吗?

【问题讨论】:

可能是不同的 gcloud 版本?尝试在 Cloud Build 上获取当前版本,并尝试使用相同(或接近的版本)更新您的本地安装。这可能是 CLI 的变化 我尝试提取最后两个版本,但仍然遇到同样的问题。这也是我的确切想法,但这并没有帮助:/ 应该是谷歌内部的bug...下周试试吧! 嗨,OP。我建议在您的构建配置中使用相同的gcloud 版本,类似于您在部署工作时使用的版本。由于这是一个内部错误,我们无权了解您的项目的进展情况,因此我建议向support 提交案例。 【参考方案1】:

对我们来说,这正是发生在这个时候!我们检查了很多东西,但最后通过电子邮件发送给谷歌云支持服务,这是他们的错误而不是我们!他们修好了。

【讨论】:

以上是关于在 Cloud Build 上部署到 AppEngine 失败 -- 但不是在本地的主要内容,如果未能解决你的问题,请参考以下文章

如何使用 Cloud Build 在 GCP 上部署功能?

如何为 Cloud Build 用于 Cloud Run 部署的 Cloud Storage 存储分区指定区域?

Cloud Build 无法部署到 Google App Engine - 您无权充当 @appspot.gserviceaccount.com

使用 Cloud Build 和 VPC 连接器将 Node 应用程序自动部署到 App Engine

GCP Cloud Build 标签发布

尝试使用 cloud build (gcp) 部署时出现 URL not found