VCS Labeling - additional information needed, documentation is incomplete

Hi,

how does the VCS Labeling feature work with git?

Does it create a simple tag or annotated tag?

Will this trigger further builds if for example some configuration is watching

+:refs/tags/*

(builds are configured to create a build on each new tag)

Will this tag a build which was triggered by a new tag?

E.g.

In some config I am watching: `+:refs/tags/*` in order to build and deploy some version

Someone pushes a new tag which is a semver: 1.0.2

This triggers a build which gets the version stamp 1.0.2-12

```

"git" describe --abbrev=0 %build.vcs.number% --tags > __query.tmp
set /p result=<__query.tmp
del __query.tmp
echo ##teamcity[buildNumber '%%result%%-%build.counter%']

```

Using that buildnumber will this then tag the commit which already has tag 1.0.2 with this new tag 1.0.2-12?

Assuming that new tag is added, this would trigger a new build, because we are watching `+:refs/tags/*` and continue doing so forever?

Afaik its not possible to restrict branches in vcs root and vcs trigger configs with some regex which could avoid this loop in this scenario.

Something like this (see also:  https://regex101.com/r/EcaulX/1):

+:refs/tags/^(?<major>\d+)[.](?<minor>\d+)([.](?<patch>\d+))?
-:refs/tags/^(?<major>\d+)[.](?<minor>\d+)([.](?<patch>\d+))?([-](?<buildnumber>\d+))?

 

0
1 comment

Hi Martin,

thanks for your comment. In your situation, as you mentioned, you would enter on an infinite loop. We do not carry this information around so TeamCity cannot stop a build from triggering on a new tag.

This said, there might be a way to actually stop this from repeating itself in your scenario:
-Create some %major%, %minor%, %patch% parameters at the project/build configuration level.
-Optionally, create some %version% parameter which is based on %major%.%minor%.%patch%
-Add the following rules:
+:refs/tags/*
-:refs/tags/%major%.%minor%.%patch%-* (or tags/%version%-* if done)

This would require the extra maintenance of manually updating the parameters, although you would also be able to use them for many other tasks, such as packaging, easy labeling, etc in case you need them, if you don't have them already.

Also, please feel free to add a feature request to our issue tracker to implement a system to prevent teamcity from triggering on its own labels: https://youtrack.jetbrains.com/issues/TW

0

Please sign in to leave a comment.