如何一次性更新composer环境的多个配置字段?

huangapple go评论70阅读模式
英文:

How can I update multiple configuration fields of a composer environment at once?

问题

当我尝试运行 gcloud composer environments update 并指定 --update-labels--update-env-variables 时,我收到了以下错误消息:

Composer 部署失败,错误信息为:ERROR: (gcloud.composer.environments.update) 必须指定其中一个 (.....)。

这是自动化目的的一个非常令人沮丧的限制。

这是命令行界面(cli)还是API本身的限制?我希望我的部署脚本能够更新多个值,而不必循环遍历所有选项并为每个选项都发出一次调用,即使我可以使用 --async 也不想这样做。

我在文档中找不到答案。我是否可以通过使用SDK以编程方式调用API来绕过这个限制?

英文:

When I try to run gcloud composer environments update and specify --update-labels and --update-env-variables I get an error:

Composer deployment failed with error: ERROR: (gcloud.composer.environments.update) Exactly one 
of (.....) must be specified.

That is a very frustrating limitation for automation purposes.

Is this a limitation of the cli or the API proper? I want my deployment scripts to make it possible to update multiple values and I really don't want to have to loop over all options and make a call for each one- even if I can use --async.

I wasn't able to find answers in the docs. Can I get around this by calling the API programmatically with the SDK?

答案1

得分: 1

这个命令是否适用于您的用例?我尝试只是重复执行命令以更新环境变量和更新标签:

user@cloudshell:~ (my-project)$ gcloud composer environments update \
    samplenestor \
    --location us-central1 \
    --update-env-variables=SAMPLEKEY=700
gcloud composer environments update \
    samplenestor \
    --location us-central1 \
    --update-labels samplelabel=guitar

结果: 如何一次性更新composer环境的多个配置字段?

更新:

目前,这是Cloud Composer的一个限制,因此在问题中提到了错误:

> 在单个请求的updateMask中只能包含一个更新类型。例如,不能在同一请求中同时更新PyPI包和标签。

暂时我已经为这个查询创建了一个功能请求/问题跟踪器,可以关注更新:
https://issuetracker.google.com/issues/296867228

英文:

Would this command be applicable to your use case? I tried just repeating the command with update env variable and update labels:

user@cloudshell:~ (my-project)$ gcloud composer environments update \
    samplenestor \
    --location us-central1 \
    --update-env-variables=SAMPLEKEY=700
gcloud composer environments update \
    samplenestor \
    --location us-central1 \
    --update-labels samplelabel=guitar

Result: 如何一次性更新composer环境的多个配置字段?

UPDATE:

It appears that this is a limitation for Cloud Composer at the moment hence the error mentioned in the question:

> Only one update type may be included in a single request's updateMask. For example, one cannot update both the PyPI packages and labels in the same request.

For the mean time I have created a feature request/issue tracker for this inquiry that can be followed for updates:
https://issuetracker.google.com/issues/296867228

huangapple
  • 本文由 发表于 2023年7月31日 22:37:24
  • 转载请务必保留本文链接:https://go.coder-hub.com/76804664.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定