-
Notifications
You must be signed in to change notification settings - Fork 664
Closed
Description
Describe the bug
GitVersion outputs inconsistent JSON type for the ShortSha (likely also the Sha) when the Sha is a valid numeric (JSON) type.
Expected Behavior
Sha and ShortSha should consistently be output as a string.
Actual Behavior
ShortSha was output as a numeric type
Possible Fix
Reason is that the output text represents both a valid numeric type and a valid string and string is a better representation of the output data
Steps to Reproduce
Honestly, the bug seems simple and I'm not sure how to fudge a commit hash for GitVersion
Representative output (version.json):
{
"Major":0,
"Minor":1,
"Patch":1,
"PreReleaseTag":"beta.31",
"PreReleaseTagWithDash":"-beta.31",
"PreReleaseLabel":"beta",
"PreReleaseNumber":31,
"WeightedPreReleaseNumber":30031,
"BuildMetaData":"",
"BuildMetaDataPadded":"",
"FullBuildMetaData":"...",
"MajorMinorPatch":"0.1.1",
"SemVer":"0.1.1-beta.31",
"LegacySemVer":"0.1.1-beta31",
"LegacySemVerPadded":"0.1.1-beta0031",
"AssemblySemVer":"0.1.1.0",
"AssemblySemFileVer":"0.1.1.0",
"FullSemVer":"0.1.1-beta.31",
"InformationalVersion":"...",
"BranchName":"feature/...",
"EscapedBranchName":"feature-...",
"Sha":"2009069671b7c431168cc4181fd9d0033ab187ae",
"ShortSha":2009069,
"NuGetVersionV2":"0.1.1-beta0031",
"NuGetVersion":"0.1.1-beta0031",
"NuGetPreReleaseTagV2":"beta0031",
"NuGetPreReleaseTag":"beta0031",
"VersionSourceSha":"6a55755c0114117e8e2ca5d19d0916400c3df0f2",
"CommitsSinceVersionSource":31,
"CommitsSinceVersionSourcePadded":"0031",
"CommitDate":"2020-06-01"
}Context
We were conveniently using awk (instead of jq) to retrieve the shortSha within a pipeline to get an improved guarantee on build uniqueness; this bug reduces that guarantee.
Your Environment
bitbucket pipelines with Git, but really N/A
- Docker image: gittools/gitversion:5.3.1-linux-debian.9-x64-netcoreapp3.1
- command: /tools/dotnet-gitversion /output file /outputfile doc/version.json