Eugene
Eugene

Reputation: 3447

TFS build with multiple GIT repositories

Looks like TFS supports only one repository per build. It is not enough for me as soon as I need to use some 3rd party libraries stored separately.

I can use GIT submodule for this, but in this case the build will not be associated with commits and work items because it ignores commits from submodules. Besides, a change in submodule will not trigger the build.

Is it possible to define a build with multiple repositories using plugins, extensions or something like that?

Upvotes: 6

Views: 5998

Answers (2)

Cece Dong - MSFT
Cece Dong - MSFT

Reputation: 31075

As @jessehouwing mentioned there is no way to build multiple GIT repositories by default. @jessehouwing and @Giulio Vian have provided some workarounds here:

  1. Use Nuget or other Package Manager to store the 3rd party libraries, and add a NuGet restore task to restore the libraries.

  2. Add Command Line task to call git.exe to pull the additional repositories.

  3. Create two build definition, in the second build definition, you need to add a powershell task. In the powershell script, you can use TFS REST API to queue the first build definition.

But none of them will associate commits and work items in two repositories with one build. I found there is already a UserVoice at website below, you can vote it:

https://developercommunity.visualstudio.com/idea/365522/allow-tfs-build-to-depend-on-multiple-repositories.html

Upvotes: 6

jessehouwing
jessehouwing

Reputation: 115037

No, this is currently not possible. Instead, it's recommended to have your 3rd party libraries built and stored in the Package Management feature (as a NuGet or npm package) and take a dependency on the package instead of the source. This will not associate work items on 3rd party dependencies though.

Of course, if you really want to, you could call git.exe from a powershell or batch script and fetch the additional repositories. This will not associate work items either though.

Upvotes: 4

Related Questions