Matrix
Matrix

Reputation: 2659

Fetch the latest image from ACR that doesn't start with a prefix

I'm gonna fetch the latest image from ACR repository which doesn't include a specific prefix: Here is what I have now:

$ az acr repository show-tags --name myacr --repository myrepo --orderby time_desc --top 1 --output tsv

The list of images are like this:

"prefix-7471",
"prefix-7470",
"7469",
"prefix-7467",
"prefix-7466",
"prefix-7459",
"7455",
...

The above command shows the tag : "prefix-7471" as output however I want it to fetch tag: "7469"

Is there anyway that I can get this?

Upvotes: 0

Views: 954

Answers (1)

4c74356b41
4c74356b41

Reputation: 72211

how about using grep?

az acr repository show-tags --name myacr --repository myrepo --orderby time_desc \
    --output tsv | grep -v "prefix"

and then you can take the first string from the output

ps. I dont think you can do notcontains jmespath query?

Upvotes: 0

Related Questions