从 ACR 存储库获取最新的图像标签

Getting the latest image tag from ACR Repository

我需要在我的管道中使用 bash 命令从 Azure 容器注册表 (ACR) 获取最新的图像标签,并将该标签用于容器部署。 这是我可以使用 Azure cli 找到的内容:

  $ az acr repository show-tags --name myacr --repository myrepo --top 1

然而这个 returns 我是最旧的标签。

如何从 ACR 仓库获取最新推送的标签?

查看此文档:az acr repository show-tags 及其参数说明:

Order the items in the results. Default to alphabetical order of names.

根据您的命令,它按名称的字母顺序排序,因为您没有指定 --orderby

添加参数--orderby time_desc使结果按时间排序。