Build taking a dependency on a build from same commit but different branch
We have a setup like this:
- Build `A` -> Build the project which uses the git repository tags to calculate a version, which is embedded in our product. This is triggered on new commits (VCS trigger on `refs/heads/*`).
- Build `B` -> Release the project, this is triggered when a tag is created in git (VCS trigger on `refs/tags/*`). This build has snapshot and artifact dependencies on `A`. The former is set to not run a new build if there is a suitable one.
- The VCS root as a branch specification of `+:*` and has `Use tags as branches` on
- Both builds use the same VCS root
Our workflow is:
- Push a change (eg to git `master`), which would trigger build A with a TeamCity branch (ie %teamcity.build.branch%) of `refs/heads/master`
- When we want to release, we tag the `head` of `master` (eg with `1.0.0`), which will trigger build B.
- B would then trigger A as there is no build `A` with a "TeamCity branch" of `1.0.0`
However, after upgrading to 10.0.0 (I have reproduced this on a clean install), A is not triggered for "TeamCity branch" `1.0.0`. Rather B uses the dependencies from the previous successful build on that commit, which is from a different "TeamCity branch", ie `/refs/heads/master`.
The same situation occurs if a new branch is added to git (not using tags at all), a build of B on branch `bar` still gets the build from the same commit but different branch (eg `master`)
It also does not make a difference if the builds are manually or VCS triggered
This means that the artifacts are incorrect.
Build B Build Chain showing the issue:

Build B Dependencies

Build B Build dependencies for Build run under 9.1.7

Please sign in to leave a comment.
Hello Robert,
There were changes in behavior, see the request https://youtrack.jetbrains.com/issue/TW-34788. Now TeamCity reuses build on the same revision from default branch is reused in the build chain.
> This means that the artifacts are incorrect.
Could you please clarify this statement? Do you have different artifacts for build that run on the same branch?
This ended up being discussed outside the forums and JetBrains has provided an option to re-enable this behaviour in 10.0.4: https://youtrack.jetbrains.com/oauth?state=%2Fissue%2FTW-47052#comment=27-1808075