4

We are using hierarchical branch names so we have something like:

  • master
  • somework (branched off and merged into master)
  • olderrelease/master
  • olderrelease/someworkonolderrelease (branched off and merged into olderrelease/master)

We have set up TeamCity so that one set of build projects will build only git branches that are prefixed with olderrelease/. The branch specifications for these builds is refs/heads/olderrelease/*.

This has been working well for us. However, the problem is with TeamCity projects without a prefix, where we need to negate all sub-folders. For these we've been doing the following:

+:refs/heads/*
-:refs/heads/olderrelease/*

This does work but we've got quite a few sub-folders now so excluding them all with -: is getting very repetitive quickly, especially when you add tags into the mix too.

What I want to write is something like:

+:refs/heads/*
-:refs/heads/*/*

But this doesn't work. Is there any way of including the root branches but excluding any nested branch "folders"?

James Bateson
  • 1,069
  • 13
  • 20

1 Answers1

0

Unless you modify your branch naming convention to be more easily parsed with a single wildcard, your option remains to singularly exclude the undesired branch(es) by using only one wildcard character per rule (emphasis added by me).

TeamCity Branch Spec Documentation

The syntax of the branch specification field is newline-delimited list of "+|-:branch_name" rules. "+:" rules include the matching branches into the list, the "-:" rules exclude the branches from the list. Each rule can have one optional "*" placeholder which matches one or more characters.

Drew Grubb
  • 373
  • 3
  • 8