Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Select Git branch for TeamCity Build Configuration

I want to accomplish following via teamcity in my CI box.

Master branch commit : Build and Release
Beta branch commit: Build and Release to Crashlytics
All other commits to any other branch: Build

(side note since most of our development branches may or may not contain a prefix, it makes it difficult to use "feature-*" branch naming)

Following this question Select Git branch for TeamCity Build

I have created a Configuration Parameters in my project settings

enter image description here

and then

my VCS root settings

enter image description here

Then I created a build template

enter image description here

When I created builds I made sure branch name is correct

enter image description here

I have also tried to edit Triggers

enter image description here

How ever this is not working because when I push a commit to Beta branch

I think because of ref/heads/* default build is running all the branches

and Beta and Master displays "Pending"

enter image description here

How can I correct this?

like image 404
u.gen Avatar asked Dec 30 '15 21:12

u.gen


People also ask

How do I create a specific branch in TeamCity?

To run builds from a specific branch or set of branches automatically, configure build triggers. You can also filter history by a branch name if you're interested in a particular branch. TeamCity assigns a branch label to the builds from the default branch too.

What is branch filter in TeamCity?

Branch filter description. Version Control Settings of a build configuration. Limit the set of branches available for the build configuration. This branch filter is applied before any other branch filter and limits branches shown in the custom build dialog, as well as branches visible to triggers and build features.

How do I change my VCS root in TeamCity?

To view and manage all VCS roots configured within a project, go to Project Settings | VCS Roots. Here, you can filter the project's roots by name and modify other filter options.

What is a build configuration in TeamCity?

Last modified: 27 October 2022. This section contains articles on how to create and configure build configurations via the TeamCity UI. A build configuration is a collection of settings used to start a build and group the sequence of the builds in the UI.


1 Answers

I solved the problem by talking to other developers and making sure that all development branches uses a prefix, in this case XAAI-

then in my VCS root settings

enter image description here

for triggers in each build configuration I make sure it only is triggered when that branch is checked in.

for example for QA (Betabuild)

enter image description here

this is the tricky part , for Development branches I had to give an empty parameter, I dont know why (maybe because something needs to check default branch which is supposed to be ref/heads/) but whatever the reason it is working.*

enter image description here

and then finally whole thing looks like this

enter image description here

That pending thing is still annoying but , I think at least it is working as I envisioned now.

like image 100
u.gen Avatar answered Sep 24 '22 02:09

u.gen