问题
We had some success using the branches concept of TeamCity in subversion by pointing to tags
like mentioned here https://stackoverflow.com/a/6875151/2416394 although we are aware that this is primary for DVCS
like git.
We've extended the answer from the link by providing a project parameter %Tag%
which became part of the checkout rule.
So our SVN Root is http://myserver/svn/tags/
and the checkout rule is
+:%Tag%=>.
Each time we checkout a new tag is added as "branch" and build the source, this is fine
Now we started experimenting with chained builds. Let's say I have those configs:
- Source Build
- Installer-Lite
- Installer-Full
Both Installers need source, both have it as snapshot and artifact dependency. The main problem is: Tag
is a mandatory parameter for Source Build but not for the other, I don't want to replicate all properties to each config.
So whenever I trigger any installer, source gets build with %Tag%
set to empty.
Which then results in building
http://myserver/svn/tags/%Tag%
with an empty tag. This checks out all tags in the "Default" branch in one workspace which later fails to build as the structure is different and anyway way to large.
回答1:
Since Installer-Lite and Installer-Full have snapshot dependencies on Source Build, they can refer to its %Tag%
variable using %dep.SourceBuild.Tag%
(where SourceBuild
is the ID of the Source Build config).
Hence, you can do one of the following:
- option 1: the checkout rule in Installer-Lite becomes
+:%dep.SourceBuild.Tag%=>.
- this is briefer but slightly less legible
- option 2: Installer-Lite gets its own
%Tag%
variable, its value set to%dep.SourceBuild.Tag%
, and then the same checkout rule as Source Build, i.e.+:%Tag%=>.
- more things to set up, but the checkout rules are symmetrical and hence less surprising for the maintainer
来源:https://stackoverflow.com/questions/32718293/can-teamcity-branches-concept-be-applied-to-subversion-with-build-chains