0
votes

Consider a yaml based pipeline

resources:
  repositories:
    - repository: templates
      type: git
      name: My-Proj/azure-build-templates

...
stages:
  - template: test_pipeline/include-build-java-sonarqube.yml@templates
    parameters:
      agent_pool_name: $(agentPoolName)
      maven_goal: 'mvn clean package'
...

This will refer to repository azure-build-templates in branch master. Is there a way I can declare to refer a tag instead of master? like name: My-Proj/azure-build-templates@release-20211215-better-tag

Context of its utility: Recently we pushed something in master which consequently broke all the pipelines referring. As a fix we had to rollback with git operations on master branch. I wonder if there would be a way to refer from tag like jenkins and rollback would be just point from one git tag to another. (Downside on every release you have update all the pipelines, so I am up for any suggestions for templates release management). Thanks.

ref: https://docs.microsoft.com/en-us/azure/devops/pipelines/process/resources?view=azure-devops&tabs=schema#define-a-repositories-resource

1

1 Answers

0
votes

You can link to any ref.

Tags are represented in git as refs/tags/myTag

resources:
  repositories:
  - repository: string  # identifier (A-Z, a-z, 0-9, and underscore)
    type: enum  # see the following "Type" topic
    name: string  # repository name (format depends on `type`)
    ref: string  # ref name to use; defaults to 'refs/heads/main'

You can list your tags with: git show-ref --tags