gpt4 book ai didi

具有多个标签的 Azure DevOps Docker 任务

转载 作者:行者123 更新时间:2023-12-03 05:11:10 26 4
gpt4 key购买 nike

我讨厌 Azure DevOps,但我一直在使用它......他们有一个 Docker@2 任务,其中包含 documentation

string. Optional. Use when command = build || command = push || command = buildAndPush. Default value: $(Build.BuildId). Specifies a list of tags on separate lines. These tags are used in build, push and buildAndPush commands.

具体 -> 在单独的行上指定标签列表。

有人能够让它工作吗?

我尝试过:

steps:
- task: Docker@2
displayName: build and push image
inputs:
containerRegistry: <my-registry-connection>
repository: <my-repo-name>
command: 'buildAndPush'
tags:
- latest
- $(Build.SourceVersion)

失败了

/build-pipeline.yml (Line: 20, Col: 7): A sequence was not expected

steps:
- task: Docker@2
displayName: build and push image
inputs:
containerRegistry: <my-registry-connection>
repository: <my-repo-name>
command: 'buildAndPush'
tags:
latest
$(Build.SourceVersion)

失败的原因是:

invalid argument "***/my-repo-name:my-commit latest" for "-t, --tag" flag: invalid reference format

最佳答案

我猜单独的行对不同的人来说意味着不同的事情:

这有效:

steps:
- task: Docker@2
displayName: build and push image
inputs:
containerRegistry: <my-registry>
repository: <my-repository>
command: 'buildAndPush'
tags: latest,$(Build.SourceVersion)

关于具有多个标签的 Azure DevOps Docker 任务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/76782526/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com