使用 gcloud --filter 进行模式匹配

Har*_*low 1 gcloud

我想获取与特定模式匹配的标签列表,为此我一直在使用以下命令:

gcloud container images list-tags gcr.io/project/reposiory --format="json" --filter="tags:*_master"

但我收到这个警告:

WARNING: --filter : operator evaluation is changing for consistency across Google APIs. tags:*_master currently matches but will not match in the near future. Run `gcloud topic filters` for details.

我已经四处搜寻,但找不到我应该如何继续执行此操作。有谁知道我如何以这种方式匹配模式,即所有以“_master”结尾的标签?

Ger*_*erb 6

正如文档中提到的,您可以使用正则表达式。

要使用正则表达式,您可以使用--filter="key ~ value. 在这种情况下,key将是“标签”。对于value,您需要匹配以“_master”结尾的任何内容。您可以在正则表达式中使用 a$来锚定到字符串的末尾。

结合所有这些,您的新过滤器将是:--filter="tags ~ _master$"