Build with VCS Labelling is never re-used

I am using TeamCity 2017.2. I have a build chain like this:

  • Test jobs A, B, C
  • Aggregate Test (Composite type): snapshot dependency on A, B, C
  • Tag Master: snapshot dependency on Aggregate test, also has VCS labelling (only runs for master branch)
  • Release: snapshot dependency on Tag master

All snapshot dependencies are set to re-use existing builds if possible. All jobs use the same VCS root. There are no other builds depending on these. What I observe is that if I run Release twice, the second run re-uses Aggregate Test, A, B and C, but does not re-use Tag Master (it runs it again, thereby creating another VCS label on the same commit). I made sure no configuration changes were made in between and confirmed that the two runs of Tag Master have the same digest in the hidden artifacts. I expected Tag Master to also be re-used, and that is the effect I want to achieve because I don't want duplicate VCS labels.

I am not sure why this happens - I suspect that builds using the VCS Labelling feature will always get re-run...? Is that deliberate?

A workaround may be to stop using the VCS Labelling feature and instead add a manual "git tag" step but I wonder if I am missing something obvious...

 

0
3 comments

Hi Dave,

thanks for the detailed report. VCS Labelling should not prevent a build from being reused, unless some other conditions are met. The full list is available here: https://confluence.jetbrains.com/display/TCD10/Snapshot+Dependencies

You have already mentioned half the points mentioned in the article not to apply, but there are still some other options you didn't mention, so you might want to double check them.

Also, TeamCity picks up several hidden artifacts, such as the build settings and the like. You can open 2 of the builds that you expect should have been reused, check the hidden artifacts, and under "settings", see whether the digests differ, and if so, what's the difference in the build settings xml file. If they are the same but the build is not getting reused, please report back so that we can investigate further.

0
Avatar
Permanently deleted user

Hmm, OK. Yes I already checked the digests (as I said in the original post), and they are identical.

I thought about the documentation you linked some more. One possibility is that Tag Master does set one if its parameter values using the "##teamcity[setParameter ... ]" message in the log. If that counts as a build with a customized parameter, maybe that prevents it from being re-used? Does that sound plausible?

If so, perhaps I could get access to that information in another way such as an artifact dependency and avoid the re-triggered build that way...

0
Avatar
Permanently deleted user

I am still struggling a bit with this.

I have modified the Tag Master configuration so that it no longer uses the VCS Labelling feature, and no longer sets a parameter value from the build. I have then observed Tag Master builds being re-used in some cases.

However I am seeing other situations in which the Aggregate Test configuration (the composite) is not re-used. These chains re-use A, B and C, but they do re-run Aggregate Test and also Tag Master. Comparing the individual builds of Aggregate Test I can confirm:

  • both chains use the same commit SHA of the VCS root
  • the option to use successful builds is enabled and all the builds are successful
  • no personal builds
  • no customised parameters
  • both chains are set to re-use suitable builds everywhere
  • build settings and digest are identical

I cannot understand in this case why the Aggregate Test was not re-used even though all of its dependencies were re-used and the settings are identical. Any ideas would be very welcome.

0

Please sign in to leave a comment.