kirillbasic
kirillbasic

Reputation: 57

TeamCity building specific branch on pull request

I have a solution that consists of several projets like this:

MySolution
-Project1
-Project2
-Project3

For each project I have a branch on github, for example Project1Branch, Project2Branch... I have configured triggers on teamcity for builing containers on pullrequest into master. But when it happens all three projects are build, though changes are made only in Projeсt1. I tried to configure branch filter in triggers for build step +:Project1* but in doesn't work. How can i solve this issue?

Upvotes: 0

Views: 1695

Answers (1)

lmsec
lmsec

Reputation: 374

TL;DR

  • Leave your Trigger branch filters to +:*.
  • In the Pull Requests build feature, configure the "source" to Project1Branch and "target" to master branches.
  • Keep your VCS configuration minimal (see below).

For Project1 to build at each MR of Project1Branch into master :

Only watch the Project1Branch branch. In your VCS configuration :

  • Default branch: refs/heads/Project1Branch
  • (optional unless you need branch-filtered build steps) Branch specification: Project1Branch

Add the merge-request/... branches that match your pattern to the watched branches. Pull Request Filtering :

  • By source branch: +:refs/heads/Project1Branch
  • By target branch: +:refs/heads/master

Trigger on every change in watched branch. Triggers :

  • Branch filters: +:*

If you only want to trigger on MR branches, do Triggers :

  • Branch filters:
+:*
-:Project1Branch

The same goes for Project2 and Project3.

Upvotes: 3

Related Questions