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)

0
8 comments

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)? 

0
Avatar
Permanently deleted user

Hi Eric,

here are the screenshots.

 

0

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?

0
Avatar
Permanently deleted user

I overwrite the build number during the build

0

Can you please describe how you are overwriting the build number during the build? I can't seem to replicate this on my end.

0
Avatar
Permanently deleted user

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"']"

----

0

Thanks for writing back to share your findings. It seems like this command has a generous amount of quotation marks:

Write-Host "##teamcity[buildNumber '"$version"']"

By enclosing $version in single quotes, your non-working version works for me:

$version = "1.0.0-pre1";
Write-Host "Setting buildNumber to "$version
Write-Host "##teamcity[buildNumber '$version']"
0
Avatar
Permanently deleted user

Mhm. This line:

Write-Host "Setting buildNumber to "$version


creates this output with 2 spaces in the build log:


Setting buildNumber to  1.0.0-pre  
0

Please sign in to leave a comment.