azure - ADO YAML 失败 : No repository found by name templates

标签 azure azure-devops azure-pipelines azure-pipelines-yaml

我正在尝试将 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/

相关文章:

WebAPI2 中的 Azure AD 图形请求

.net - 我们可以将 WEBSITE_LOAD_USER_PROFILE=1 添加到 web.config 中吗

azure - 无法在独立区域路径之间移动Azure DevOps

azure-devops - 依赖于私有(private) AZ 存储库的 Azure 构建管道

azure-devops - VSTS - 基于文件夹更改触发构建

azure - 尝试使用 ARM API 获取 token 时未授权

Azure PowerShell - Invoke-AzContainerInstanceCommand - 术语 'processÂ' 未被识别为 cmdlet 的名称

Azure 管道数据同步

azure-devops - AzureDev Ops CI 构建未更新版本 (VersionPrefix)

azure - 所有通过 Sendgrid 拦截的电子邮件,如何重新发送电子邮件?