version-controlteamcityteamcity-9.0

How to run all the builds in a row in the Teamcity project with the same checkout branch


I have a Teamcity Project with VCS Root configured like this:

I hope it means I may pass any branch name and it will be processed successfully. The project contains two builds. Let it be STEP_A and STEP_B.

STEP_B has a trigger finishBuildTrigger:

{ buildType = "${STEP_A.id}" branchFilter = "+:*" }

which means it will starts after the STEP_A ends.

I want to run all the builds via REST API. I do POST /app/rest/buildQueue with parameter branchName = "feature_222".

Ok, I see that STEP_A successfully starts with feature_222 branch checkout. After it ends STEP_B starts to run BUT with develop branch checkout. Of course, it is not a desirable behavior.

What should I do to fix that?


Solution

  • I would re-configure this pipeline to rely on the snapshot dependency rather than on the finish build trigger. So, follow the steps below:

    This is how it looks like:

    enter image description here

    According to the docs:

    Build configurations linked by a snapshot dependency can optionally use revisions synchronization to ensure the same snapshot of the sources.

    To tell it short, the snapshot dependency is the mechanism to enforce the same version (snapshot) of the sources being built by the build chain.

    See the official documentation for more details.