I need a list of the 20-30 latest image versions that have been pushed to the gcr using APIs.
I know that we can use https://cloud.google.com/sdk/gcloud/reference/container/images/list. But I want it using apis. I have used client.tags() from the registry-client api mentioned in https://github.com/google/nodejs-container-image-builder#registry-client-api. It provides all the image tags, but I need a list of recent image versions pushed, starting from most recent to least recent. Is there any module or API to accomplish this?
I'm unfamiliar with the specific SDK but familiar with GCR and the Registry API.
Is your issue that the
client.tags()does not return timestamps?One useful trick with
gcloudis that you can append--log-httpto any command to see what underlying API calls are being made by the command:Here's an example using one of my public registries:
Results:
GCR uses Docker's Registry API v2 (and, in my experience, implements the API correctly|fully). I recommend you consider exploring using it if the SDK is insufficient.
But please also file a feature request against the SDK.
I wrote about my experiences grokking the registry API here and include examples
curl'ing GCR:https://medium.com/google-cloud/adventures-w-docker-manifests-78f255d662ff