1
votes

Let's say I have two builds in my TeamCity build chain, both using the same VCS root. The 2nd build starts after the 1st one finishes (the 2nd has a snapshot dependency on the 1st).

The 1st build uses VSC labeling build feature and adds a new tag to Git repository after the build is done.

The problem I encounter is that the 2nd build doesn't get this new tag. For instance, if I run git describe as the very first step of the 2nd build, it will return the "previous" tag value. I believe, the reason for such "lag" is the fact that according to the TeamCity documentation:

The [labeling] process takes place in the background after the build finishes

So when the 2nd build does VCS checkout, the Git repository doesn't have the new tag yet (as it is being applied in the background, apparently after the 2nd build starts), so for the 2nd build the "previous" tag is actually the latest one available.

Is there a way to run the 2nd build only after the VCS labeling is done?

I can think of adding a dummy step with some timeout to ensure that labeling process has enough time to finish, and only then run the 2nd build, but that looks like an ugly crutch.

1
What are your polling times like for this repo? You can view in administration > diagnostics > VCS statusJeff Gruenbaum
The 2nd build triggers on 1st successful build (and snapshot dependency enforces revisions synchronization), so polling doesn't matter in this case.retif
It may not matter, but it could give an indication of why the labeling is taking too long.Jeff Gruenbaum
It's unlikely to be long, but the since the 2nd build and VCS labeling start simultaneously (or maybe the build goes even earlier than VCS labeling), then it will be too late anyway.retif

1 Answers

2
votes

Well, it appears to me that this is by design, so there is unlikely to be a solution for that. It is really a shame though, because using this default feature could have saved some effort.

So I decided to go with the following workaround: instead of using the VSC labeling build feature, I add a new tag in one of the build steps "manually", to ensure that this operation completes before the build is done.

Here's the workflow for better clarity:

  1. The 1st build starts
  2. One of its build steps explicitly adds a new tag using CLI and Git. The new tag is now in my Git repository
  3. The 1st build finishes, and that triggers the 2nd build start
  4. The 2nd build starts and gets the new tag with no problems

Since it's a workaround, I won't mark this answer as accepted.