Search code examples
gittfstfsbuildtfs-2015azure-pipelines

Creating a BuildvNext Definition that uses a Git Repo in a different Team Project


I'm working at an Organization that uses TFS 2015 for ALM. The structure looks like this:

  • Collection
    • WIT TP (TFVCS)
    • Code TP1 (Git)
    • Code TP2 (Git)

All work item tracking is accomplished in the 'WIT TP' Team Project, within Project Teams. This also includes all areas, iterations, and (most importantly) Test plans/cases.

All code is stored in separate Team Projects such as Code TP1. In general, there is a 1-1 correlation between code Team Projects and a Project Team inside the work tracking Team Project.

In particular, the code for automated tests resides in a code Team Project. You may know that Microsoft Test manager can only look at build definitions created within the Team Project. The specifics aren't important, really, here's my goal:

Create a build definition in one team project using the source files located in a git repo belonging to another team project

I know this can work with TFVCS. I can see no good reason why it can't work for git. I've tried to refer to the (actually internal) git repo as an "External Git Repo" and creating what I believed were the correct endpoints but ran into an error:

Too many redirects or authentication replays
Prepare repository failed with exception.

One other issue I'm running into is that the work item team project uses TFVCS. Thus, in the Repository tab of the build definition editing window, no option for the internal git repository appears. Experimenting with other team projects using git has not been any better - although I can select a Git repo I can't refer to one in a different part of the server.

Thanks for your help!


Solution

  • The link you referred to only works when both the two projects are using TFVC repository. Since the latest TFS version support both TFVC and Git repository in one team project, I would recommend you to place the code of your two Git projects in the work item project. This will allow you to configure the build definition more conveniently.

    If you don't want to move the code to work item project, an alternative way would be adding a Power-Shell script in your build definition to clone the code from Git projects during the build process.