Run a build step on a specific branch only
Asked Answered
U

3

9

I have a build configuration containing two build steps "Build" and "Deploy". This build configuration is using a Git VCS and is configured to run all branches.

Let's assume that I currently have two branches "master" and "Feature in Development".

I want to divide the "Deploy" step into two. "Deploy Production" and "Deploy Beta". The "Deploy Production" step should only be executed when the master branch was changed and is currently building.

Is there a built in possibility to do that or do I have to check the %teamcity.build.branch.is_default% variable manually within the script?

Upset answered 20/5, 2015 at 20:16 Comment(0)
U
4

It seems that JetBrains added this feature in TeamCity v9.1.

For v9.0 I used a Powershell script and checked '%teamcity.build.branch.is_default%' -eq 'true' build property.

Upset answered 13/8, 2015 at 15:46 Comment(3)
Where do you see this feature in 9.1? Do you have a link?Diphase
First hit on Google and it's the worst answer I've seen on SX. WHERE is this new feature? I'm on the latest version and there are no options I see to only run a step for a specific branch.Electric
For those coming to this not-so-helpful answer, here's a much clearer answer I found: #33159124 Note: Scroll down to the second answer.Jarl
M
2

You can add a condition to a build step in TC using the dropdown within advanced option setting for build step:

enter image description here

Monde answered 30/10, 2020 at 15:26 Comment(0)
F
0

Why not create a two build configuration for that, one checking code from master, second from branch? IMHO it should not be steps in the same build as they are not chained.

Florenceflorencia answered 8/6, 2015 at 18:38 Comment(1)
TeamCity is licensed per build configurationPedroza

© 2022 - 2024 — McMap. All rights reserved.