Using Multiple VSC Roots - Which one does it use for Pending Changes?

Hello,

I am currently setting up a project in TeamCity which has 4 VCS roots.

One is Perforce which is the main VCS with all the source, projects and solutions. The other 3 VCS roots are Git and contain tools needed to build, run test, ect.

When we go in the UI, under this specific project, it is showing the Pending Changes of one of the Git repos. Also when we click the "Run" button for our build configuration, the Changes tab is showing the branches and changes of the same Git repo. The Git repo only contain our build config files so we don't need it to show in TeamCity.

We want TeamCity to use the Perforce VSC as our "main" VSC. It's the changes from our Perforce depot that our clients care about. Is this possible?

3
10 comments

Hi Nicola,

The list of pending changes should be displayed for all VCS Roots, not just for one. That's at least how it's working on the last version. If the changes in your repo are very very recent, it's possible that you are looking before TeamCity has had a chance to check the other repositories (how long it will take depends on your checking for changes period configuration of your VCS Root).

Changes are displayed for all repositories, as changes in the build config files can also impact the result of a build, aside from the fact that TeamCity can't identify that as the content.

0

Ok I seem to be seeing the changes for all the repos.

Another problem I am seeing is with the default branch. From which repo does the default branch and "logical branch name" being displayed taken from?

0

The default branch is set up per repo. The "Logical branch name" is decided upon start of a build or build chain. To maintain consistency throughout the dependency chain, a "logical branch name" is decided (the selected branch if you run a custom build, the determined one on triggers, default on manual runs), and applied to all the build configurations in the chain. If a build configuration doesn't have access to such a branch in it's VCS Root, it will fall back to the default.

0

The problem is I need the "logical branch name" to be that of the Perforce branch that is used. The git repo's contain just tools and we don't care for their branch names to be displayed.

I was able to show "prod" as the "logical branch name" for the build configuration that is triggered by setting the teamcity.build.branch property, but the dependencies all show "master" as the "logical branch name".

I tried to pass the perforce branch ("prod") to the dependencies with the reverse.dep.*.teamcity.build.branch and it seems to work for a split second as it displays "prod" but it then reverts back to "master"! I think this may be because the teamcity.build.branch.is_default property for all the dependant build configurations is set to true. I tried to set that to false but that did not work either.

Is there any way to override the "logical branch name" for the build configurations? Why doesn't Perforce have the default branch property?

We are on 2017.1 and there is a new "Allow builds in the default branch" property for the VCS Roots but unchecking this does not work as TC thinks it's on the default branch. 

0

How are you running the builds? Do you run them automatically through a trigger, manually clicking on "Run", or run custom builds?

0

All 3.

VSC Root trigger that polls the Perforce depot, using the run button and with custom builds where we change the default values of some parameters.

0

Hi Nicola,

When triggering through the VCS Trigger, the branch on which everything is run should be the branch of the VCS change. When triggering through the custom build, you select the branch by yourself on the "Changes" tab. (By default, it will fall back to the default branch). The regular "Run" button will run on the default branch. Perforce's default branch is the "stream" that you have configured as default.

If changes only happen in the VCS Root of perforce, then that should be selected as the logical branch. If you run a custom build and select the changes from perforce, then that branch should be used as the default.

If running a build with any of this methods tells you that it was run in "master" instead of "prod", could you send us a screenshot, please?

0

The problem is that we are not using P4 Streams.

We use client mapping, for example:

//productname/%build.branch%/... //team-city-agent/%build.branch%/...

The %build.branch% is what we want displayed.

Below is a Build Chain on a Custom Run: 

0

Just for confirmation:
-That picture displays "prod" in the build chain summary, also prod in the last step. Are all the rest in master correct? Or are all those build configurations taking the code from prod as well? Do all the builds contain the perforce VCS Root? Is this an example of what you want, being correct, and some other instances being wrong? If not, could you specify where it's wrong?

0

Yes all the build configurations are taking the code from prod and contain the perforce VSC root (which is defined in a template that all the build configurations use).

This is an example of it being wrong. All the dependencies should show prod and not master.

0

Please sign in to leave a comment.