Conditional build run



I'm trying to not run a build (not failed to start, i want to not run this build)

We actually have a build chain :

A => B1

   => B2

   => B3

              => C

The step A is checking changes on the VCS

The step B1 is checking Javascript

The step B2 is checking SQL

The step B3 is checking DOT.NET

The step C is the build chain (finish)


I would like to not run the B2 if there is no SQL modification ? How can i achieve this scenario ?

I use a build chain to run simultaneously B1 and B2 and B3. But those builds can be long to run, so i want them to run only if they are meant to be run.


Thanks in advance

Comment actions Permalink


I believe the new 2020.1 release feature about the conditional steps execution could be useful here:

Long story short, it should allow you to modify the B2 build so that it would consist of two steps:
1) check if there are SQL modifications and set a build parameter if there are any;
2) make the actual build step run only if the parameter is set.

This is the rough idea; if you could explain what is actually happening on the B2 build and what is the criteria you use to understand if there were any SQL changes (do you have certain subpath on the repository where SQL-specific changes would reside?), I could suggest more.

Comment actions Permalink


We just have done the upgrade to 2020.1 because we thinked this new feature would allow us to do what we need, but it's for step of the build not the build itself.

The build A is creating a file (yaml) providing all the changes by categories (SQL/JS/DOT.NET) , so in fact we like to run B2 (SQL) only if the file contains SQL modification.

Currently the build B2 is always running even if there is no modification, but in this build we check if they are modications or not. So we have false "green" positive because the build is run every time even without things to do.

I don't know if I'm making myself clear.

I can add some screenshot if needed.

Best regards,

Comment actions Permalink


Thank you for the details. I agree - the approach I have suggested would still make the build B2 run, even if it would be over in a few seconds because of no new changes being found. 

We have a few feature requests regarding the conditional build execution:
Please feel free to vote for them as you see fit.

In regards to the "false positive" build being reported - maybe this feature will prove helpful?
As a quick summary, this allows to set a custom status for the build. A quick example; below is an excerpt from the command line script:

echo ##teamcity[buildStatus text='This build has been skipped'] 

This caused the build status to update accordingly:

Would this make the build run more informative to you?


Please sign in to leave a comment.