I experience a very strange behaviour with the --filter
--format
and --limit
flags.
I have the following command:
gcloud run revisions list --sort-by=~creationTimestamp --service "api-gateway" --platform managed --format="value(metadata.name)" --filter="spec.containers.env.name=ENDPOINTS_SERVICE_NAME"
The command returns me this list with in total 177 items:
api-gateway-00295-xeb 2020-07-21T06:46:14.991421Z
api-gateway-00283-wug 2020-07-20T14:41:02.108809Z
api-gateway-00281-yix 2020-07-20T14:32:17.325634Z
api-gateway-00278-ham 2020-07-20T12:50:13.385984Z
api-gateway-00276-mol 2020-07-17T12:21:36.897245Z
api-gateway-00274-nih 2020-07-16T07:50:18.544546Z
api-gateway-00272-kol 2020-07-13T12:55:35.485589Z
api-gateway-00270-vis 2020-07-13T08:38:52.352422Z
api-gateway-00263-zaf 2020-07-10T14:08:36.502972Z
...
The first thing is, that the timestamp is returned for a strange reason. (I actually state what I want to get with --format
and when I remove the --sort-by
flag the timestamp is gone.)
Secondly, when I add --limit 1
no result is returned at all!
gcloud run revisions list --sort-by=~creationTimestamp --service "api-gateway" --platform managed --format="value(metadata.name)" --filter="spec.containers.env.name=ENDPOINTS_SERVICE_NAME" --limit 1
With --limit 5
only two are returned, so as a result it cloud be that the limit is applied before filtering, although the documentation says that is should be the other way around.
However the "latest" entry is api-gateway-00295-xeb
and should be returned with a limit of 1.
I don't understand the behaviour of the gcloud CLI here.
Does anyone have explanations for the two things?
As @DazWilkin suggested I created an issue at the public google issue tracker here: https://issuetracker.google.com/issues/161833506
The Cloud SDK engineering team is looking into this, however there is no ETA.