TeamCity CI Builds for TFS Feature Branches

I have almost everything that is created in Team City perfectly, with the exception of constantly created release branches / functions.

It will be difficult to describe, but hopefully this should make sense.

I have the following versioning structure in TFS:

$/ProjectName/releases/1.2 $/ProjectName/features/create-doodads $/ProjectName/trunk 

I have the following build option:

 env.SourceBranch = trunk 

This is used to configure the source control root:

 Root = $/ProjectName CheckoutRule = +:%env.SourceBranch%=>./ 

Here, where things get interesting:

When I run a custom assembly and manually specify env.SourceBranch , then the assembly will work with the specified branch because it is configured in the validation rule. In 7.1 there is a new function that displays the branch label on the project pages next to the assembly number, after which it will correctly display next to the assembly and all subsequent assemblies in the assembly chain.

So far so good, when I enter the branch again, it does not start automatically.

I understand why this happens ... the default validation rule is trunk , which means that it does not match any validation event in releases or features , however, I'm not quite sure that my parameters are there.

I think what I want is the ability to specify an assembly trigger that sets a parameter that is passed to the vcs root ... or something like that.

Any help would be greatly appreciated, let me know if this is unclear, and I will try to explain further.

Edit:

I tried playing with validation rules by doing something like this:

 +:trunk=>./ +:releases/*=>./ +:features/*=>./ 

Unfortunately this does not work.

It seems that what I'm trying to do is what is being proposed here , which makes me think that this is not yet possible.

+4
source share
1 answer

I think that what you are describing is simply trying to automatically build from different branches based on triggers (similar to how git works). Unfortunately, this is not an option with source controls outside of distributed models (e.g. git and mercurial) in TC at the time of writing, which I know of.

I suggest creating different build configurations based on the template, each using a different branch specified in the build options. I think that if you follow the CI promotion model, it will be very useful and easy to follow. Thus, you will have three assembly configurations in your example and one template where everything will be exactly the same between all three assemblies, with the exception of one parameter:% env.SourceBranch%.

0
source

Source: https://habr.com/ru/post/1433647/


All Articles