简体   繁体   English

Azure 容器注册 | 如何在 azure 管道内为我的 docker 标签图像和我的 ACR 获取相同/当前版本的 Git 标签回购?

[英]Azure Container Registry | How do I get the same/current versioning Git Tag Repo for my docker tag image and my ACR, inside of the azure pipeline?

I'm currently try to find a better way to do my git tags since I want to do the NPM versioning and use the same tag into my container registry in Azure. How can I use the same tag from my repo into the git tag?我目前正在尝试找到一种更好的方法来执行我的 git 标签,因为我想执行 NPM 版本控制并将相同的标签用于 Azure 中的容器注册表。如何将我的存储库中的相同标签用于 git 标签? What I'm trying to do in here is that the same git repo tag needs to be the same as the one that my docker image will have.我在这里尝试做的是相同的 git 回购标签需要与我的 docker 图像将具有的标签相同。 In this case, my repo tag and my container registry will reflect the same tag.在这种情况下,我的 repo 标签和我的容器注册表将反映相同的标签。

Example:例子:

Repo-Tag:
V1.0.0

Docker image:
V1.0.0

Azure Container Registry:
V1.0.0

Does anyone knows the best thing to do in here?有谁知道在这里最好的事情吗?

In the build pipeline, you can use the predefined build variables Build.SourceBranch or Build.SourceBranchName to get the name of the source branch / tag of the build.在构建管道中,您可以使用预定义的构建变量Build.SourceBranchBuild.SourceBranchName来获取构建的源分支/标记的名称。

  • If the build is triggered from a branch, the value of the predefined variable is the branch name.如果构建是从分支触发的,则预定义变量的值为分支名称。
  • If the build is triggered from a tag, the value of the predefined variable is the tag name.如果构建是从标签触发的,则预定义变量的值是标签名称。

在此处输入图像描述

On the docker build task, you can try like as below to set the image tag.在 docker 构建任务上,您可以尝试如下设置图像标签。

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM