Reputation: 1642
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.
Upvotes: 2
Views: 397
Reputation: 1642
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:
Since it's a workaround, I won't mark this answer as accepted.
Upvotes: 3