无法使用 GCloud CLI 迁移到另一个服务版本

Couldn't migrate to another service version with GCloud CLI

我看过文档说gcloud app versions migrate操作可以将流量迁移到另一个版本,但是不能。错误描述似乎提供了一些信息,但对我没有帮助。在 GCP 控制面板上,版本迁移工作正常。这是怎么回事?

 $ gcloud app versions migrate 20190122-120543-ebbfbc9 -s q
 Migrating all traffic from version [q/20190129-164614-09e8288] to 
 [q/20190122-120543-ebbfbc9]
 Do you want to continue (Y/n)?

 ERROR: (gcloud.app.versions.migrate) Issues migrating all traffic of service(s): [q]

 INVALID_ARGUMENT: Invalid request.
 - '@type': type.googleapis.com/google.rpc.BadRequest
   fieldViolations:
   - description: Warmup requests must be enabled for all versions that will gain additional
       traffic as a result of the traffic migration.
     field: service.split.allocations[20190122-120543-ebbfbc9]

当您使用 gcloud app versions migrate 时,它将尝试在目标版本上执行 gradual migration. Gradual traffic migration is only supported for the Standard environment and you have to enable warmup requests 以使其工作。

它在 GCP Console 上运行,因为如果不满足上述条件,系统会提示您立即迁移。

如果您想使用 gcloud 将流量迁移到设置为禁用预热的 GAE 标准版本或 Flex 环境,您可以使用以下命令,它实际上会立即(不是逐渐)将流量 100% 分配到目标版本:

gcloud app services set-traffic [MY_SERVICE] --splits [MY_VERSION]=1

您可以找到更多信息here

希望对您有所帮助! :)