Skip to content

GitVersion throws Error parsing Infinity value on Jenkins and TeamCity #1982

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ajaskiewiczpl opened this issue Dec 10, 2019 · 14 comments
Closed
Labels

Comments

@ajaskiewiczpl
Copy link

ajaskiewiczpl commented Dec 10, 2019

I'm using GitVersion.Tool 5.1.1 (dotnet core) inside my PowerShell build script and it crashes when running in Jenkins multipipeline job. It throws error:

`

"C:\Program Files\dotnet\dotnet.exe" D:\Dev\NuGet\gitversion.tool\5.1.1\tools\netcoreapp3.0\any\GitVersion.dll
Error parsing Infinity value. Path '', line 1, position 1.
at Newtonsoft.Json.JsonTextReader.ParseNumberPositiveInfinity(ReadType readType, Boolean matched)
at Newtonsoft.Json.JsonTextReader.ParseValue()
at Newtonsoft.Json.JsonReader.ReadAndMoveToContent()
at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
at Nuke.Common.Tools.GitVersion.GitVersionTasks.GetResult(IProcess process, GitVersionSettings toolSettings)
at Nuke.Common.Tools.GitVersion.GitVersionTasks.GitVersion(GitVersionSettings toolSettings)
at Nuke.Common.Tools.GitVersion.GitVersionTasks.GitVersion(Configure1 configurator) at Nuke.Common.Tools.GitVersion.GitVersionAttribute.GetValue(MemberInfo member, Object instance) at Nuke.Common.Execution.InjectionUtility.InjectValuesInternal[T](T instance, IEnumerable1 tuples)
at Nuke.Common.Execution.InjectionUtility.InjectValues[T](T instance, Func2 filter) at Nuke.Common.Execution.BuildManager.Execute[T](Expression1[] defaultTargetExpressions)
`

It happens both on Jenkins and TeamCity.

@hvincente
Copy link

Same problem here.

@matkoch
Copy link
Contributor

matkoch commented Dec 19, 2019

@SignumPL @hvincente are you using private repositories (which need authorization)? And what are your CI systems?

@hvincente
Copy link

Ok, after more tests, i found a more explicit error.
And you're right, it's the internal git fetch that raise an authentication error.
My git repository is private, all tags and refs are present locally, so i disabled fetch and everything works fine now.
Thanks for your help.

@ajaskiewiczpl
Copy link
Author

ajaskiewiczpl commented Dec 20, 2019

I'm using private repo but I don't see any authentication errors in Jenkins console output:

`Started by user admin

git.exe rev-parse --is-inside-work-tree # timeout=10
Setting origin to https://git.my.domain/user/repo.git
git.exe config remote.origin.url https://git.my.domain/user/repo.git # timeout=10
Fetching origin...
Fetching upstream changes from origin
git.exe --version # timeout=10
git.exe config --get remote.origin.url # timeout=10
using GIT_ASKPASS to set credentials
git.exe fetch --tags --force --progress -- origin +refs/heads/:refs/remotes/origin/ # timeout=10
Seen branch in repository origin/develop
Seen branch in repository origin/feature/jenkins
Seen branch in repository origin/feature/prototype
Seen branch in repository origin/jenkinstest
Seen branch in repository origin/master
Seen 5 remote branches
Obtained Jenkinsfile from 3ae90a147ca0b83b56fc96538a251a65b5341d11
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] Start of Pipeline
[Pipeline] node
Running on Jenkins in C:\software\Jenkins\workspace\myproject.myproject_jenkinstest@2
[Pipeline] {
[Pipeline] stage (Checkout)
Using the ‘stage’ step without a block argument is deprecated
Entering stage Checkout
Proceeding
[Pipeline] checkout
using credential 353032f3-6ae4-42d3-861e-d029dc80f555
Wiping out workspace first.
Cloning the remote Git repository
Avoid fetching tags
Cloning repository https://git.my.domain/user/repo.git
git.exe init C:\software\Jenkins\workspace\myproject.myproject_jenkinstest@2 # timeout=10
Fetching upstream changes from https://git.my.domain/user/repo.git
git.exe --version # timeout=10
using GIT_ASKPASS to set credentials
git.exe fetch --no-tags --force --progress -- https://git.my.domain/user/repo.git +refs/heads/:refs/remotes/origin/ # timeout=10
git.exe config remote.origin.url https://git.my.domain/user/repo.git # timeout=10
git.exe config --add remote.origin.fetch +refs/heads/:refs/remotes/origin/ # timeout=10
git.exe config remote.origin.url https://git.my.domain/user/repo.git # timeout=10
Cleaning workspace
git.exe rev-parse --verify HEAD # timeout=10
No valid HEAD. Skipping the resetting
git.exe clean -fdx # timeout=10
Fetching upstream changes from https://git.my.domain/user/repo.git
using GIT_ASKPASS to set credentials
git.exe fetch --no-tags --force --progress -- https://git.my.domain/user/repo.git +refs/heads/:refs/remotes/origin/ # timeout=10
Checking out Revision 3ae90a147ca0b83b56fc96538a251a65b5341d11 (jenkinstest)
git.exe config core.sparsecheckout # timeout=10
git.exe checkout -f 3ae90a147ca0b83b56fc96538a251a65b5341d11 # timeout=10
git.exe branch -a -v --no-abbrev # timeout=10
git.exe checkout -b jenkinstest 3ae90a147ca0b83b56fc96538a251a65b5341d11 # timeout=10
Commit message: "."
git.exe rev-list --no-walk 3ae90a147ca0b83b56fc96538a251a65b5341d11 # timeout=10
Cleaning workspace
git.exe rev-parse --verify HEAD # timeout=10
Resetting working tree
git.exe reset --hard # timeout=10
git.exe clean -fdx # timeout=10
[Pipeline] stage (Build)
Using the ‘stage’ step without a block argument is deprecated
Entering stage Build
Proceeding
[Pipeline] powershell
PowerShell Desktop version 5.1.18362.145
Microsoft (R) .NET Core SDK version 3.1.100
Microsoft (R) Build Engine version 16.4.0+e901037fe for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

Restore completed in 386.18 ms for C:\software\Jenkins\workspace\myproject.myproject_jenkinstest@2\build_build.csproj.
_build -> C:\software\Jenkins\workspace\myproject.myproject_jenkinstest@2\build\bin\Debug_build.dll

Build succeeded.
0 Warning(s)
0 Error(s)

Time Elapsed 00:00:01.16
Creating directory 'C:\software\Jenkins\workspace\[email protected]'...

███╗   ██╗██╗   ██╗██╗  ██╗███████╗
████╗  ██║██║   ██║██║ ██╔�██╔�����
██╔██╗ ██║██║   ██║█████╔� █████╗
██║╚██╗██║██║   ██║██╔�██╗ ██╔���
██║ ╚████║╚██████╔�██║  ██╗███████╗
╚��  ╚���� ╚������ ╚��  ╚��╚�������

NUKE Execution Engine version 0.23.4 (Windows,.NETStandard,Version=v2.0)

"C:\Program Files\dotnet\dotnet.exe" D:\Dev\NuGet\gitversion.tool\5.1.1\tools\netcoreapp3.0\any\GitVersion.dll
Error parsing Infinity value. Path '', line 1, position 1.
at Newtonsoft.Json.JsonTextReader.ParseNumberPositiveInfinity(ReadType readType, Boolean matched)
at Newtonsoft.Json.JsonTextReader.ParseValue()
at Newtonsoft.Json.JsonReader.ReadAndMoveToContent()
at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
at Nuke.Common.Tools.GitVersion.GitVersionTasks.GetResult(IProcess process, GitVersionSettings toolSettings)
at Nuke.Common.Tools.GitVersion.GitVersionTasks.GitVersion(GitVersionSettings toolSettings)
at Nuke.Common.Tools.GitVersion.GitVersionTasks.GitVersion(Configure1 configurator) at Nuke.Common.Tools.GitVersion.GitVersionAttribute.GetValue(MemberInfo member, Object instance) at Nuke.Common.Execution.InjectionUtility.InjectValuesInternal[T](T instance, IEnumerable1 tuples)
at Nuke.Common.Execution.InjectionUtility.InjectValues[T](T instance, Func2 filter) at Nuke.Common.Execution.BuildManager.Execute[T](Expression1[] defaultTargetExpressions)

Repeating warnings and errors:
Error parsing Infinity value. Path '', line 1, position 1.

���������������������������������������
Target Status Duration
───────────────────────────────────────
Clean NotRun 0:00
BuildUI NotRun 0:00
Restore NotRun 0:00
Publish NotRun 0:00
───────────────────────────────────────
Total 0:00
���������������������������������������

Build failed on 20/12/2019 18:43:45.

[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code -1
Finished: FAILURE
`

@jameswoodley
Copy link

I am getting exactly the same in TeamCity. Runs fine if I call it in PowerShell, however in a TeamCity build the same error as stated above

NUKE Execution Engine version 0.23.4 (Windows,.NETStandard,Version=v2.0)
  
  > "C:\Program Files\dotnet\dotnet.exe" "C:\Users\James Woodley\.nuget\packages\gitversion.tool\5.1.1\tools\netcoreapp3.0\any\GitVersion.dll"
  Error parsing Infinity value. Path '', line 1, position 1.
     at Newtonsoft.Json.JsonTextReader.ParseNumberPositiveInfinity(ReadType readType, Boolean matched)
     at Newtonsoft.Json.JsonTextReader.ParseValue()
     at Newtonsoft.Json.JsonReader.ReadAndMoveToContent()
     at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter)
     at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
     at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
     at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType)
     at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
     at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
     at Nuke.Common.Tools.GitVersion.GitVersionTasks.GetResult(IProcess process, GitVersionSettings toolSettings)
     at Nuke.Common.Tools.GitVersion.GitVersionTasks.GitVersion(GitVersionSettings toolSettings)
     at Nuke.Common.Tools.GitVersion.GitVersionTasks.GitVersion(Configure`1 configurator)
     at Nuke.Common.Tools.GitVersion.GitVersionAttribute.GetValue(MemberInfo member, Object instance)
     at Nuke.Common.Execution.InjectionUtility.InjectValuesInternal[T](T instance, IEnumerable`1 tuples)
     at Nuke.Common.Execution.InjectionUtility.InjectValues[T](T instance, Func`2 filter)
     at Nuke.Common.Execution.BuildManager.Execute[T](Expression`1[] defaultTargetExpressions)
  
  
  Repeating warnings and errors:
  Error parsing Infinity value. Path '', line 1, position 1.

@hvincente
Copy link

The parsing error is raised when the result us parsedt. This result is normally a Json object if the command went well but when there is an error it is not the case. Can you test with the GitVersion.exe executable and run it in console.
You should get an error instead of the expected Json object.

@jameswoodley
Copy link

PS E:\TeamCity\buildAgent\work\c2adec15d98387ec> GitVersion
{
  "Major":0,
  "Minor":1,
  "Patch":4,
  "PreReleaseTag":"teamcity.7",
  "PreReleaseTagWithDash":"-teamcity.7",
  "PreReleaseLabel":"teamcity",
  "PreReleaseNumber":7,
  "WeightedPreReleaseNumber":7,
  "BuildMetaData":"",
  "BuildMetaDataPadded":"",
  "FullBuildMetaData":"Branch.teamcity.Sha.1126b527f7069537cf4af0d000371c50a2551f15",
  "MajorMinorPatch":"0.1.4",
  "SemVer":"0.1.4-teamcity.7",
  "LegacySemVer":"0.1.4-teamcity7",
  "LegacySemVerPadded":"0.1.4-teamcity0007",
  "AssemblySemVer":"0.1.4.0",
  "AssemblySemFileVer":"0.1.4.0",
  "FullSemVer":"0.1.4-teamcity.7",
  "InformationalVersion":"0.1.4-teamcity.7+Branch.teamcity.Sha.1126b527f7069537cf4af0d000371c50a2551f15",
  "BranchName":"teamcity",
  "Sha":"1126b527f7069537cf4af0d000371c50a2551f15",
  "ShortSha":"1126b52",
  "NuGetVersionV2":"0.1.4-teamcity0007",
  "NuGetVersion":"0.1.4-teamcity0007",
  "NuGetPreReleaseTagV2":"teamcity0007",
  "NuGetPreReleaseTag":"teamcity0007",
  "VersionSourceSha":"695c4a2d4204b3eb9df5ec19e787a2d0a1766afa",
  "CommitsSinceVersionSource":7,
  "CommitsSinceVersionSourcePadded":"0007",
  "CommitDate":"2019-12-21"
}

@robertmircea
Copy link

I have the same issue when running from Teamcity agent on Linux.

@matkoch
Copy link
Contributor

matkoch commented Dec 30, 2019

So far I can say that the issue is either that the repository is private (needs authorization), or that you’re building on TeamCity, and the branch cannot be determined (probably detached). For the latter, you can try to set env.Git_Branch to the branch somehow via another TeamCity parameter. That might also be an issue with TeamCity.

@BlowaXD
Copy link

BlowaXD commented Jan 5, 2020

Got the "same" problem here:
Only on Linux Debian 10 (working on Windows, don't have a Mac sorry), public repository, netcoreapp3.1, nuke 0.23.4 (this one)

An easy step to reproduce :

FROM mcr.microsoft.com/dotnet/core/sdk:3.1

WORKDIR /app
COPY . .
docker build -t test .
docker run -it --rm test
chmod +x ./build.sh
./build.sh Compile

@ajaskiewiczpl
Copy link
Author

I'm using NUKE build system and I resolved this issue by manually editing _build.csproj and updating GitVersion.Tool to version 5.1.3. Also in Build.cs specify target framework for GitVersion:

[GitVersion(Framework = "netcoreapp3.1")] readonly GitVersion GitVersion;

@stale
Copy link

stale bot commented May 17, 2020

This issue has been automatically marked as stale because it has not had recent activity. After 30 days from now, it will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label May 17, 2020
@asbjornu
Copy link
Member

Have everyone properly normalized the Git repository before executing GitVersion, as per #2194? For TeamCity, this means you will have to set teamcity.git.fetchAllHeads=true, among other things.

@stale stale bot removed the stale label May 17, 2020
@stale
Copy link

stale bot commented Aug 15, 2020

This issue has been automatically marked as stale because it has not had recent activity. After 30 days from now, it will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Aug 15, 2020
@stale stale bot closed this as completed Sep 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants