Reuse same build pipeline for different repository on Azure DevOps

て烟熏妆下的殇ゞ 提交于 2019-12-22 07:59:32

问题


I have a project on Azure DevOps containing multiple forks of the same main repository. I created a build pipeline for that repository which unfortunately cannot be reused for the present forks since a pipeline can only be configured for a single repository.

This solution is not ideal because leads to multiple identical pipelines, one for each fork, and maintaining all of them can be difficult.

Is there a way to use one pipeline for multiple repositories?


回答1:


you can create a template file and reference that file from each pipeline, that way you can edit a single file and every pipeline will change.

example how to reuse a step file from different repo

resources:
  repositories:
  - repository: DevOps
    type: git
    name: DevOps
trigger: none

jobs:
- template: vsts/yaml/build.yaml@DevOps
  parameters:
    solutionName: xxx
    registryName: yyy

You can take a look at the official docs for more examples

https://docs.microsoft.com/en-us/azure/devops/pipelines/process/templates?view=azure-devops




回答2:


It's on the roadmap for 2019 Q3:

Multi-repository support for YAML pipelines https://dev.azure.com/mseng/AzureDevOpsRoadmap/_workitems/edit/1454026



来源:https://stackoverflow.com/questions/55742637/reuse-same-build-pipeline-for-different-repository-on-azure-devops

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!