我正在尝试将 ADO YAML 文件编辑到最低限度,以便隔离另一个问题。
当我运行验证时,它返回以下错误:
未按名称模板找到存储库
这是我的 YAML 的一般要点:
#resources:
# repositories:
# - repository: templates
# type: git
# name: TemplateProject/TemplateRepo
name: $(VersionName)
trigger:
branches:
include:
- main
batch: true
paths:
exclude: $(ListOfExclusions)
stages:
- template: core/setVersion.yml@templates
- stage: Build
pool: linux
jobs:
- job: BuildDocker
displayName: Build and Push Docker Image
pool: linux
steps:
- task: Docker@2
displayName: Build and push an image to container registry
inputs:
command: buildAndPush
repository: $(RepoName)
dockerfile: $(Build.SourcesDirectory)/Dockerfile
containerRegistry: $(dockerRegistryServiceConnection)
tags: |
$(Tag)
可能出了什么问题?错误消息让我认为 YAML 不干净。
最佳答案
事实证明,我在注释掉 YAML 的 resources
部分时造成了一个简单的拼写错误。我的舞台中有一个模板
部分也需要注释掉,但我忽略了这样做。
一旦我将代码更新为:
stages:
# - template: core/setVersion.yml@templates
- stage: Build
pool: linux
jobs:
- job: BuildDocker
# etc...
现在我的 YAML 通过 OK
进行验证。
关于azure - ADO YAML 失败 : No repository found by name templates,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/74691436/