microsoft / azure-pipelines-yaml

Azure Pipelines YAML examples, templates, and community interaction
MIT License
1.19k stars 926 forks source link

Is there a way I can define the azure pipeline template to be imported from a tag? [resources/repository/git] #554

Closed saurabh-sp-tripathi closed 2 years ago

saurabh-sp-tripathi commented 2 years ago

Consider a yaml based pipeline

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

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?

Context of its utility: Recently we pushed something in master which consequently broke all the pipelines. As a fix we had to rollback with git operations. 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

KarolSiedlik commented 2 years ago
resources:
  repositories:
    - repository: templates
      type: git
      name: My-Proj/azure-build-templates
      ref: refs/tags/<your tag>

you can use any ref here, like feature or commit

saurabh-sp-tripathi commented 2 years ago

Thanks @KarolSiedlik. Is there a way to use variable-group or something similar in ref to centrally control release and rollback of my pipeline templates?

anatolybolshakov commented 2 years ago

Hi @saurabh-sp-tripathi this repo is mostly for yaml templates support located in this repo - for any questions regarding Azure DevOps I would suggest to open ticket on https://developercommunity.visualstudio.com/search?space=21 to get right eyes on it. I believe you can use pipeline variables as a value for ref.

anatolybolshakov commented 2 years ago

Closing this at the moment as external - please let us know if you have any other questions.