teamcityteamcity-7.0

Preventing Unnecessary Triggers On Teamcity


I searched my problem on both questions and answers. I could find a question same as my problem but, what a pity, it's not answered.

Prevent Excessive Builds in TeamCity

I have lots of modules and same situation for lots of dependencies.

To simplify;

I have X, Y, Z modules and dependencies like that: Z->Y->X

When a code commited to X module, X1 started to run.

When X1 completed, Y module triggered and Y1 started to run.

When Y1 completed, Z module triggered and Z1 started to run.

While Z1 runs, a code commited to Y and Y2 started to run.

At this point, since Z2 will be triggered as soon as Y2 completed, Z1 build will become needless. Because Z2 is newer and Z2 must be used.

On the other hand, the modules depends on Z will be triggered unnecessarily (when Z1 finished) too, since Z2 gonna trigger same modules when Z2 finished.

I checked Teamcity documentation; also forums. I don't think it is rare situation but cannot find an answer or solution.

Any help will be appreciated.


Solution

  • I understand the pain but I think the way this works is necessary to properly map problem builds to the code changes that prompted them. For example if Z1 finishes successfully and has 5 changes in it, but Z2 fails and has 3 more changes in it you would not necessarily want the code from Z1 to be associated with a failed build.

    if the builds are taking a long enough time or costing compute resources you would rather not spend you could look into cancelling the Z1 build, I don't know of a built in mechanism for this but you could write your own plugin or possibly script it via a build step

    the rest API in team city provides some ways to handle this, you can see more here