Running all the builds in the project with the same checkout branch
I have a Project with VCS Root configurated like this:
- Default branch: develop
- Branch specification: +:refs/heads/(*)
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 desirable behaviour.
What should I do to fix that?
Please sign in to leave a comment.
Hi,
your issue is explained in the description of the finish build trigger: https://www.jetbrains.com/help/teamcity/configuring-finish-build-trigger.html
As you can see there, finish build trigger will always trigger in the default branch, unless a snapshot dependency to A is set on B (and there are several other restrictions)
With this snapshot dependency, teamcity will automatically pull the same branch. This is how Snapshot dependencies work and it has some consequences you need to keep in mind:
-Every time B is triggered, an instance of A will be triggered or reused (configurable). If it's from a finish build trigger, it will reuse the one that triggered it.
-This implies, that moving a VCS Trigger (or REST API) to triggering B instead of A allows you to remove the finish build trigger entirely, as the snapshot dependency will take care of it.
-Branch will be maintained throughout the dependencies even if you add more to the chain later on, and even with different VCS Roots as long as the branch name is the same.
You can read more about this and other features of snapshot dependencies in our documentation here: https://www.jetbrains.com/help/teamcity/snapshot-dependencies.html