云构建通过将eu.artifacts.< project> .appspot.com存储桶更改为单个区域来避免计费 [英] Cloud build avoid billing by changing eu.artifacts.<project>.appspot.com bucket to single-region

本文介绍了云构建通过将eu.artifacts.< project> .appspot.com存储桶更改为单个区域来避免计费的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用适用于python 3.7的应用程序引擎标准环境.

Using app engine standard environment for python 3.7.

在运行 app deploy 命令时,会将容器映像上传到存储桶 eu.artifacts.< project> .appspot.com "中的Google存储空间.

When running the app deploy command are container images uploaded to google storage in the bucket eu.artifacts.<project>.appspot.com.

此消息是在 app部署

 Beginning deployment of service [default]...
#============================================================#
#= Uploading 827 files to Google Cloud Storage              =#
#============================================================#
File upload done.
Updating service [default]...

文件已上传到多个区域(eu),如何更改为上传到单个区域?

The files are uploaded to a multi-region (eu), how do I change this to upload to a single region?

猜测这是一个配置文件,应将其添加到存储库中,以指示App Engine,云构建或云存储将文件上传到单个区域.

Guessing that it's a configuration file that should be added to the repository to instruct app engine, cloud build or cloud storage that the files should be uploaded to a single region.

是否需要 eu.artifacts.< project> .appspot.com 存储桶,还是可以使用 .gcloudignore 文件忽略所有文件?

Is the eu.artifacts.<project>.appspot.com bucket required, or could all files be ignore using the .gcloudignore file?

问题类似于此问题

The issue is similar to this issue How can I specify a region for the Cloud Storage buckets used by Cloud Build for a Cloud Run deployment?, but for app engine.

我正在使用服务帐户触发云构建.

I'm triggering the cloud build using a service account.

试图在上面的链接中实现解决方案的更改,但无法摆脱多区域存储桶.

Tried to implement the changes in the solution in the link above, but aren't able to get rid of the multi region bucket.

substitutions:
  _BUCKET: unused
steps:
- name: 'gcr.io/cloud-builders/gcloud'
  args: ['app', 'deploy', '--promote', '--stop-previous-version']
artifacts:
  objects:
    location: 'gs://${_BUCKET}/artifacts'
    paths: ['*']

命令 gcloud构建提交--gcs-log-dir ="gs://$ BUCKET/logs"-gcs-source-staging-dir ="gs://$ BUCKET/source"-replacements = _BUCKET ="$ BUCKET"

推荐答案

经过更多调查,我想提一下部署新容器时,容器类型由容器注册表"创建(部署App Engine应用程序时)->将映像推送到具有新主机名的容器时,容器注册表在指定的多区域位置创建存储桶.此存储桶是注册表的基础存储.在一个项目中,所有具有相同主机名的注册表都共享一个存储存储桶

After investigation a little bit more, I want to mention that this kind of bucket is created by the "container registry" product when you deploy a new container( when you deploy your App Engine Application)-> When you push an image to a registry with a new hostname, Container Registry creates a storage bucket in the specified multi-regional location.This bucket is the underlying storage for the registry. Within a project, all registries with the same hostname share one storage bucket.

基于,默认情况下无法访问,它本身包含在部署新容器时写入的容器映像.不建议修改它,因为工件存储桶旨在包含部署映像,这可能会影响您的应用程序.

Based on, It is not accessible by default and itself contains container images which are written when you deploy a new container. It's not recommended to modify it because the artifacts bucket is meant to contain deployment images, which may influence your app.

最后,我发现的一个奇怪之处是,当您创建默认存储桶时(如上述存储桶的情况),您还会获得一个具有相同名称的分段存储桶,但该分段存储除外.您可以将此暂存存储桶用于暂存和测试目的的临时文件.它还有5 GB的限制,但是会在每周

Finally, something curious that I found is when you create a default bucket (as is the case of the aforementioned bucket), you also get a staging bucket with the same name except that staging. You can use this staging bucket for temporary files used for staging and test purposes; it also has a 5 GB limit, but it is automatically emptied on a weekly basis

这篇关于云构建通过将eu.artifacts.&lt; project&gt; .appspot.com存储桶更改为单个区域来避免计费的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆