【问题标题】:ADO YAML failing: No repository found by name templatesADO YAML 失败:名称模板未找到存储库
【发布时间】:2022-12-20 09:32:49
【问题描述】:

我正在尝试将 ADO YAML 文件编辑到最低限度,以便隔离另一个问题。

当我运行 Validate 时,它​​返回以下错误:

No repository found by name templates

这是我的 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 不干净。

【问题讨论】:

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


    【解决方案1】:

    事实证明,我在注释掉 YAML 的 resources 部分时造成了一个简单的拼写错误。我有一个 template 阶段的一部分也需要被注释掉,但我忽略了这样做。

    一旦我将代码更新为:

    stages:
    #  - template: core/setVersion.yml@templates
      - stage: Build
        pool: linux
        jobs:
          - job: BuildDocker
          # etc...
    

    现在我的 YAML 使用 OK 进行验证。

    【讨论】:

      猜你喜欢
      • 2019-06-23
      • 1970-01-01
      • 1970-01-01
      • 2015-07-30
      • 2022-06-15
      • 2018-09-14
      • 1970-01-01
      • 2011-11-05
      • 1970-01-01
      相关资源
      最近更新 更多