【发布时间】:2018-11-08 11:17:22
【问题描述】:
我们制定了一项政策,将资源限制在欧盟地区。
当我尝试执行云构建时,gcloud 想要创建一个存储桶 (gs://[PROJECT_ID]_cloudbuild) 来存储暂存源。此步骤失败,因为使用了默认存储桶位置 ('us'):
"code": 412,
"message": "'us' violates constraint ‘constraints/gcp.resourceLocations’"
作为一种解决方法,我尝试传递位于有效区域中的现有存储桶(使用 --gcs-source-staging-dir),但我遇到了同样的错误。
如何解决?
这里是 HTTP 日志:
$ gcloud --log-http builds submit --gcs-source-staging-dir gs://my-custom-bucket/staging \
--tag gcr.io/xxxxxxxxxx/quickstart-image .
=======================
==== request start ====
uri: https://www.googleapis.com/storage/v1/b?project=xxxxxxxxxx&alt=json
method: POST
== headers start ==
accept: application/json
content-type: application/json
== headers end ==
== body start ==
{"name": "my-custom-bucket"}
== body end ==
==== request end ====
---- response start ----
-- headers start --
server: UploadServer
status: 412
-- headers end --
-- body start --
{
"error": {
"errors": [
{
"domain": "global",
"reason": "conditionNotMet",
"message": "'us' violates constraint ‘constraints/gcp.resourceLocations’",
"locationType": "header",
"location": "If-Match"
}
],
"code": 412,
"message": "'us' violates constraint ‘constraints/gcp.resourceLocations’"
}
}
-- body end --
---- response end ----
----------------------
ERROR: (gcloud.builds.submit) HTTPError 412: 'us' violates constraint ‘constraints/gcp.resourceLocations’
【问题讨论】: