2
votes

Our builds generally have a mish mash of work items and commits associated with them and I cannot tell how TFS determines what to add. We are using TFS 2015 update 3 and TFVC.

When a build runs, it gets code from a location somewhere in the branching and folder of TFVC. Typically, something like "root\dev\src\component name" in this way we avoid getting all of the code in our repository and we have CI set up to run so that any changes in this folder will result in a CI build running.

We also run daily builds which run more tests and create a release package that is used by TFS Release Management. I would expect that any changes to code inside of the folder defined in setting up the repository for this build to be included in the associated change-sets of a build. I also expect that any changes checked-in outside of these branches would not be associated. But this is not the case. We see commits from across the entire project.

Does anyone know how this is supposed to work?

I am not sure if this should go in the question or the answer but I have found some additional information, thanks to the hints provided in the answers below.

It appears that the source settings will take the common root between mapped folders of the repository settings, so if I have 2 folders $/Relo/Dev/B1/src/Claims.Services and $/Relo/Dev/B1/src/PSScripts it will take the common root $/Relo/Dev/B1/src as the source settings and include any changes from that folder down within the build. Can anyone confirm this? Of course thats not what I want to have happen. In the History tab of the build definition if I looked at the diff I can see a field "defaultBranch" in the json which seems to be the value that controls this, is there any way to update this field directly?

2

2 Answers

2
votes

TFS determines what changesets should be mapped to a build based on the Source Repository Mappings (Build vNext) in the build definition and the last successful build.

So, you will see a list of the changesets with files committed in the lowest common base of any of the mapped folders including all their descendents, since the latest successful build. Whenever you get a successful build (I hope that it happens more often than failing ones ;-)) the list will shorten and only show the last check-in.

Example mappings below will result in any changeset made to anything below $/Relo/Dev/B1/src (because it is the lowest common base):

  • $/Relo/Dev/B1/src/Claims.Services
  • $/Relo/Dev/B1/src/PSScripts

Similar it will pick up all the related work items to the above changesets.

This is what should happen. If you see something else, I would have a closer look at the Repository Mappings or Source Settings of the build definition.

0
votes

@Noel - I guess you are using vNext build and not XAML builds. Or are you using a mix of XAML and vNext?

In general a scheduled TFS build will associate all changes which were not associated in the last successful run of the same build.

I suggest you check once again if the source folder locations are the same for CI build and Daily build?