VCS Labeling issue (prefix/leading space)
Answered
TC seems to be setting a prefixed space-character in the label. Of course I have checked (also recreated) the VCS lebeling build feature if there is really a space and there is not!
Log: Failed to set label ' 3.6.0-4933.test002' for build # 3.6.0-4933.test002 {build id=10016578, buildTypeId=MaideasyDe_Build}: jetbrains.buildServer.vcs.VcsException: Labeling failed: org.eclipse.jgit.api.errors.InvalidTagNameException: tag name 3.6.0-4933.test002 is invalid (enable debug to see stacktrace)
Please sign in to leave a comment.
What do you have in the "Labeling Pattern" field on the VCS Labeling Build Feature? Would you be able to share a screenshot of this entire menu (redacting anything confidential)?
Hi Eric,
here are the screenshots.
Thanks! Since you've defined the label as %system.build.number%, can you also share a screenshot of the "Build Number Format" field in the general settings for this build configuration?
I overwrite the build number during the build
Can you please describe how you are overwriting the build number during the build? I can't seem to replicate this on my end.
Hi Eric,
I found the error and here is how it can be reproduced. You need the Powershell Runnter to replace the build.number. I am no PowerShell expert, so this might even be expected behavior...
WORKING VERSION:
----
$version = "1.0.0-pre1";
#Does NOT add space prefix
$var4a = "Setting buildNumber to " + $version;
$var4b = "##teamcity[buildNumber '" + $version + "']";
Write-Host $var1a;
Write-Host $var1b;
NON-WORKING VERSION:
-----
$version = "1.0.0-pre1";
#Adds space prefix
Write-Host "Setting buildNumber to "$version
Write-Host "##teamcity[buildNumber '"$version"']"
----
Thanks for writing back to share your findings. It seems like this command has a generous amount of quotation marks:
By enclosing $version in single quotes, your non-working version works for me:
Mhm. This line:
creates this output with 2 spaces in the build log: