1
votes

I am going to start exactly the same as my other question (How to use yaml template parameters in Azure DevOps Server 2019 on-prem?) - According to the official documentation at https://docs.microsoft.com/en-us/azure/devops/pipelines/process/templates?view=azure-devops-2019 the Azure DevOps Server 2019 on-prem supports everything.

In particular, referencing yaml templates from another repository. However, trying to use it in practice fails with:

/azure-pipelines-common.yml: File /prepare-sonar-qube.yml not found in repository http://tdc1tfsapp01:8080/tfs/DefaultCollection/DFDevOps/_git/logs2db branch refs/heads/master version 0ba42f59f36e74ad4fe39e59e4e8a3a56a6e9ff0.

enter image description here

Here is my yaml template:

trigger:
- master

name: 1.0.$(Date:yy)$(DayOfYear)$(Rev:.r)

resources:
  repositories:
  - repository: templates
    type: git
    name: NewProductTemplate
    ref: refs/heads/shelve/yaml-templates

jobs:
- job: Build
  pool:
    demands: DotNetFramework
  workspace:
    clean: all
  variables:
  - template: variables.yml@templates
  steps:
  - template: azure-pipelines-common.yml
  - template: publish-nuget.yml@templates
  - template: publish-symbols.yml@templates
  - template: publish-code-coverage.yml@templates
  - template: promote-nuget.yml@templates

Am I doing something wrong or is this yet another case of misleading documentation?

1

1 Answers

1
votes

See statement - template: azure-pipelines-common.yml, it means you're referencing the template from current repos. The error message only indicates the prepare-sonar-qube.yml referenced by azure-pipelines-common.yml is missing in master branch of your current repos(logs2db?).

So if you define the reference to prepare-sonar-qube.yml like this in azure-pipelines-common.yml:

steps:
- template: prepare-sonar-qube.yml

You should make sure the prepare-sonar-qube.yml exists in where it current repos(logs2db) instead of another repos(NewProductTemplate). Or it's expected behavior to get errors like this:

enter image description here