问题描述
我需要在管道中使用bash命令从Azure容器注册表(ACR)中获取最新的图像标签,并将该标签用于容器部署.这是我使用Azure cli可以找到的东西:
I need to fetch the latest image tag from Azure Container Registry (ACR) with a bash command in my pipeline and use that tag for container deployment.Here is what I could find with Azure cli:
$ az acr repository show-tags --name myacr --repository myrepo --top 1
但是,这返回了我最早的标签.
However this returns me the oldest tag.
如何从ACR存储库中获取最新的推送标签?
How can I get the latest pushed tag from ACR repo?
推荐答案
请参阅以下文档: az acr存储库显示标签及其参数说明:
See this doc: az acr repository show-tags and its parameters description:
根据您的命令,由于未指定--orderby
,因此按名称的字母顺序进行排序.
Based on your command, it is ordering by alphabetical order of names since you didn't specify the --orderby
.
添加参数--orderby time_desc
以使结果按时间排序.
Add the parameter --orderby time_desc
to make the result ordered by time.
这篇关于从ACR存储库获取最新的图像标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!