3

We use Teamcity 2018 together with TFS.

We have one project in which the structure is following

Root                <---- We want to checkout the whole Root-directory
     \ProjectA      <---- We want to show changes only from the sub-directory
     \ProjectB
     \ProjectB

We would like to watch changes from Root\ProjectA-directory and display only changes that were done under that directory.

However, we would like to checkout the whole Root-directory and run our build from there.

Is there any way to do this?

Mtq
  • 53
  • 7
  • This may be of some help to you: https://teamcity-support.jetbrains.com/hc/en-us/community/posts/206191439/comments/206355795 If you require, I'll try to post a proper answer when I'm off work. – Prajnan Bhuyan Feb 01 '19 at 02:34
  • ..but checkout rules affect also which directories are checked out to the agent? We would still wish to checkout the whole Root-directory with all the sub-directories that it contains. – Mtq Feb 01 '19 at 09:54

1 Answers1

2

Trigger rules can help you accomplish this. Within your VCS trigger, you can specify a collection of rules to filter in or out various conditions that will cause your build configuration to trigger. These are independent of your VCS rules and those rules will handle what you choose to checkout as normal. The rule syntax is as follows:

+|-[:[user=VCS_username;][root=VCS_root_id;][comment=VCS_comment_regexp]]:Ant_like_wildcard

The Ant_like_wildcard is the element of particular interest to you in this case, as you can use them (among other things) to filter in or out a particular directory.

Here is an example from the TeamCity Documentation:

"-:lib/**" prevents the build from triggering by updates to the "lib" directory of the build sources

Using your example, your trigger rule would look something like:

+:ProjectA/**

You can use a single inclusion rather than multiple exclusions because of the way TeamCity handles those types of rules:

When specifying the rules, please note that as soon as you enter any "+" rule, TeamCity will change the implicit default from "include all" to "exclude all".

You can find the full TeamCity VCS Trigger documentation here

Drew Grubb
  • 373
  • 3
  • 8
  • Thank you. This is almost the solution I was looking for. With this I am able to trigger the jobs correctly. The **Change Log** however still displays changes from all projects. If I make a change into ProjectB, it won't trigger ProjectA, but once ProjectA eventually triggers or is manually triggered then the change done to ProjectB stills shows up also in ProjectA's change log. – Mtq Mar 26 '19 at 10:14
  • @Mtq Ah, I understand what additional layer you are looking for now. From a design perspective, I see why those changes are included. If you are consuming the code in project B as part of your build, changes to that code should be relevant to the overall product of the build, and thus your change log. That being said, if you want to exclude them, **the change log view has a filtering component and an advanced search option.** You should be able to specify the **containing path** field to something like `root\ProjectA` to visually filter the change log results. Does this help? – Drew Grubb Mar 27 '19 at 15:21