Overview
This extension is used to centralize pipeline-local repositories per software agent and save disk space by sharing repositories between different pipelines of the same software agent.
This means that repositories below $(Agent.BuildDirectory)
(for example $(Agent.BuildDirectory)/s
) can be moved to a centralized location below $(Agent.WorkFolder)
. This location is only centralized per software agent, and since only one pipeline can run per software agent, there's never the danger of two builds accessing the same centralized repository at the same time. However, you have to make sure that you never move two different repositories of the same name (say from two different team projects) to the same centralized location. Either give them a different name during checkout, or move them to a different centralized (folder) location with the CentralizedLocation
option.
This buildstep should be executed after the checkouts of the repositories to centralize.
Possible inputs are:
DefaultRepository
: string, The name for the folder used for the default repository of the current build normaly stored at $(Agent.BuildDirectory)/s
in the centralized location. Do not use quotes to define the path. Leave blank or don't provide if you do not want to centralize the default repository. Make sure this name will never be used by another repository on this software agent in the same centralized location. You can use variables , example: MyMainRepo
Repositories
: string, The name of the repository folders to move to the centralized location. You can separate multiple repository folders with commas. Do not use quotes to define paths. Leave blank or don't provide if you do not want to centralize any other repositories beside the default repository. Make sure these names will not be used by other repositories on this software agent in the same centralized location. You can use variables , example: MyFirstSideRepo, MySecondSideRepo
CentralizedLocation
: string, The path or folder below $(Agent.WorkFolder) in which to move the centralized repositories to. Do not use quotes to define the path. Default is 'Repositories'. You can use variables
UseJunctions
: true/false, Should we use junctions instead of symbolic links? Default is false and will use symbolic links.
pwsh
: true/false, Should Powershell Core be used if it exists? Default is true and will use powershell core. Otherwise the normal Windows Powershell (5) will be used.
Example
This example will check out the default repository to $(Agent.BuildDirectory)/s
as well as the repository MyFirstSideRepository to $(Agent.BuildDirectory)/My1stSideRepository
and repository MySecondSideRepository to $(Agent.BuildDirectory)/MySecondSideRepository
.
It will then centralize these repositories to $(Agent.WorkFolder)/AllMyRepositories/MyMainRepository
, $(Agent.WorkFolder)/AllMyRepositories/My1stSideRepository
and $(Agent.WorkFolder)/AllMyRepositories/MySecondSideRepository
respectively.
Normally $(Agent.WorkFolder)
will be the _work
directory.
- checkout: self
- checkout: MyFirstSideRepository
path: My1stSideRepository
- checkout: MySecondSideRepository
path: MySecondSideRepository
- task: tun.CentralizeRepositories.CentralizeRepositories.CentralizeRepositories@1
displayName: 'Centralize repositories'
inputs:
DefaultRepository: MyMainRepository
Repositories: My1stSideRepository, MySecondSideRepository
CentralizedLocation: AllMyRepositories
UseJunctions: false
pwsh: true
Notes