Skip to content
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

+0 in Version numbers (VSTS) #758

Closed
pascalberger opened this issue Jan 26, 2016 · 9 comments
Closed

+0 in Version numbers (VSTS) #758

pascalberger opened this issue Jan 26, 2016 · 9 comments

Comments

@pascalberger
Copy link
Member

Since around mid December I sometimes receive strange version numbers in VSTS builds for repos hosted on VSTS.

Using GitFlow, for a master build the version number looks now like 2.0.0.+0 instead of 2.0.0.

Sometimes it even picks the wrong version or makes stuff like 1.2.0+2.

@pascalberger
Copy link
Member Author

Here is the build output of such a build:

    2016-01-18T10:21:05.6975063Z Executing the following commandline. (workingFolder = D:\BuildAgent\tasks\GitVersion\3.3.0)
    2016-01-18T10:21:05.6975063Z D:\BuildAgent\tasks\GitVersion\3.3.0\GitVersion.exe "d:\work\138\s" /output buildserver /updateAssemblyInfo true /nofetch 
    2016-01-18T10:21:05.7131327Z Error message highlight pattern: 
    2016-01-18T10:21:05.7131327Z Warning message highlight pattern: 
    2016-01-18T10:21:05.8068868Z INFO [01/18/16 11:21:05:79] Working directory: d:\work\138\s
    2016-01-18T10:21:05.8225092Z INFO [01/18/16 11:21:05:82] Applicable build agent found: 'VsoAgent'.
    2016-01-18T10:21:05.8225092Z INFO [01/18/16 11:21:05:82] Branch from build environment: refs/heads/master
    2016-01-18T10:21:05.9787713Z INFO [01/18/16 11:21:05:96] One remote found (origin -> 'https://ioz.visualstudio.com/DefaultCollection/IOZ/_git/NuGetPackage.Mvc').
    2016-01-18T10:21:05.9787713Z INFO [01/18/16 11:21:05:97] Skipping fetching, if GitVersion does not calculate your version as expected you might need to allow fetching or use dynamic repositories
    2016-01-18T10:21:06.0881649Z INFO [01/18/16 11:21:06:08] Updating local branch refs/heads/master to point at ef98ac28fdd369bd72fbfde5b501698df4463ee2
    2016-01-18T10:21:06.2444293Z INFO [01/18/16 11:21:06:24] Skipping update of 'refs/remotes/origin/develop' as it already matches the remote ref.
    2016-01-18T10:21:06.2444293Z INFO [01/18/16 11:21:06:24] Skipping update of 'refs/remotes/origin/master' as it already matches the remote ref.
    2016-01-18T10:21:06.2444293Z INFO [01/18/16 11:21:06:24] Skipping update of 'refs/remotes/origin/release/1.0.0' as it already matches the remote ref.
    2016-01-18T10:21:06.2600456Z INFO [01/18/16 11:21:06:24] HEAD points at branch 'refs/heads/master'.
    2016-01-18T10:21:06.2600456Z INFO [01/18/16 11:21:06:26] Project root is: d:\work\138\s
    2016-01-18T10:21:06.2912685Z INFO [01/18/16 11:21:06:29] Using latest commit on specified branch
    2016-01-18T10:21:06.3381643Z INFO [01/18/16 11:21:06:33] Running against branch: master (ef98ac28fdd369bd72fbfde5b501698df4463ee2)
    2016-01-18T10:21:06.3693961Z INFO [01/18/16 11:21:06:36] Begin: Calculating base versions
    2016-01-18T10:21:06.4475420Z   INFO [01/18/16 11:21:06:44] Fallback base version: 0.1.0 with commit count source f01e31e1e5a37deab881fbdd72cf5d23c12cb35a
    2016-01-18T10:21:06.8849958Z   INFO [01/18/16 11:21:06:88] Merge message 'Merge branch 'release/1.0.0'': 1.0.0 with commit count source ef98ac28fdd369bd72fbfde5b501698df4463ee2
    2016-01-18T10:21:06.9474976Z   INFO [01/18/16 11:21:06:93] Base version used: Merge message 'Merge branch 'release/1.0.0'': 1.0.0 with commit count source ef98ac28fdd369bd72fbfde5b501698df4463ee2
    2016-01-18T10:21:06.9474976Z INFO [01/18/16 11:21:06:94] End: Calculating base versions (Took: 578.10ms)
    2016-01-18T10:21:06.9631230Z INFO [01/18/16 11:21:06:96] Skipping version increment
    2016-01-18T10:21:06.9631230Z INFO [01/18/16 11:21:06:96] 0 commits found between ef98ac28fdd369bd72fbfde5b501698df4463ee2 and ef98ac28fdd369bd72fbfde5b501698df4463ee2
    2016-01-18T10:21:06.9943734Z INFO [01/18/16 11:21:06:99] Applicable build agent found: 'VsoAgent'.
    2016-01-18T10:21:06.9943734Z Executing GenerateSetVersionMessage for 'VsoAgent'.
    2016-01-18T10:21:08.6850948Z Executing GenerateBuildLogOutput for 'VsoAgent'.
    2016-01-18T10:21:08.6850948Z Updating assembly info files
    2016-01-18T10:21:08.7009236Z ##********[task.complete result=0;]

Build was for master branch in GitFlow scenario for Version 1.0.0. Instead of the expected 1.0.0 version was SemVer was 1.0.0+0.

@JakeGinnivan
Copy link
Contributor

Just looked into this, we are using FullSemVer because otherwise you get errors with duplicated build numbers if you are using continuous deployment mode. The variables work as you would expect

@JakeGinnivan
Copy link
Contributor

Am doing a trim now for the +0, but if it's anything else it wont.

Also make sure you are using SemVer not FullSemVer in the substitution? Anyways, hopefully not an issue with 3.4.0

@pascalberger
Copy link
Member Author

@JakeGinnivan I just tested with GitVersion 3.4.0 and I still get 1.0.75+0 as GitVersion_FullSemVer.

You mention that this is expected behavior. What I don't get is that it once returned version number without the metadata (1.0.75) for GitFlow master commits for GitVersion_FullSemVer and still does for certain repositories. Therefor I assume something changed in the repos which leads to this.

@JakeGinnivan
Copy link
Contributor

I think FullSemVer always returns the +metadata but SemVer doesn't?

Maybe at some point we switched the default.

You can always change your tfs build number to $(GitVersion_SemVer) then it should give you the expected results?

@pascalberger
Copy link
Member Author

Sure, I could switch to $(GitVersion_SemVer). I'm just confused since on some repositories it returns the metadata on others I doesn't. Therefore I don't think it was a change in GitVersion, but more something in the repositories which has changed

@JakeGinnivan
Copy link
Contributor

Id love to know what it is :P I just have no idea

@pascalberger
Copy link
Member Author

Also strange that it doesn't remove the +0 from the build number with 3.4.0, which should now happen with your code in place...

@TheSaltyKorean
Copy link

TheSaltyKorean commented Dec 5, 2016

It's actually $(GitVersion.SemVer) in the log.

However what is needed is the aggregated version.

The semver is 1.2.1+4, but I need 1.2.5, any thoughts? Below is the debug log.

2016-12-05T17:12:45.8739681Z ##[debug]Update build number for build: 982 to: 1.2.1+4 at backend.
2016-12-05T17:12:46.3114089Z ##[debug]Processed: ##vso[build.updatebuildnumber]1.2.1+4
2016-12-05T17:12:46.3114089Z Executing GenerateBuildLogOutput for 'VsoAgent'.
2016-12-05T17:12:46.3124065Z ##[debug]Processed: ##vso[task.setvariable variable=GitVersion.Major;]1
2016-12-05T17:12:46.3124065Z ##[debug]Processed: ##vso[task.setvariable variable=GitVersion.Minor;]2
2016-12-05T17:12:46.3124065Z ##[debug]Processed: ##vso[task.setvariable variable=GitVersion.Patch;]1
2016-12-05T17:12:46.3124065Z ##[debug]Processed: ##vso[task.setvariable variable=GitVersion.PreReleaseTag;]
2016-12-05T17:12:46.3124065Z ##[debug]Processed: ##vso[task.setvariable variable=GitVersion.PreReleaseTagWithDash;]
2016-12-05T17:12:46.3124065Z ##[debug]Processed: ##vso[task.setvariable variable=GitVersion.PreReleaseLabel;]
2016-12-05T17:12:46.3134139Z ##[debug]Processed: ##vso[task.setvariable variable=GitVersion.PreReleaseNumber;]
2016-12-05T17:12:46.3134139Z ##[debug]Processed: ##vso[task.setvariable variable=GitVersion.BuildMetaData;]4
2016-12-05T17:12:46.3134139Z ##[debug]Processed: ##vso[task.setvariable variable=GitVersion.BuildMetaDataPadded;]0004
2016-12-05T17:12:46.3134139Z ##[debug]Processed: ##vso[task.setvariable variable=GitVersion.FullBuildMetaData;]4.Branch.master.Sha.xxx
2016-12-05T17:12:46.3134139Z ##[debug]Processed: ##vso[task.setvariable variable=GitVersion.MajorMinorPatch;]1.2.1
2016-12-05T17:12:46.3134139Z ##[debug]Processed: ##vso[task.setvariable variable=GitVersion.SemVer;]1.2.1
2016-12-05T17:12:46.3134139Z ##[debug]Processed: ##vso[task.setvariable variable=GitVersion.LegacySemVer;]1.2.1
2016-12-05T17:12:46.3134139Z ##[debug]Processed: ##vso[task.setvariable variable=GitVersion.LegacySemVerPadded;]1.2.1
2016-12-05T17:12:46.3134139Z ##[debug]Processed: ##vso[task.setvariable variable=GitVersion.AssemblySemVer;]1.2.1.0
2016-12-05T17:12:46.3134139Z ##[debug]Processed: ##vso[task.setvariable variable=GitVersion.FullSemVer;]1.2.1+4
2016-12-05T17:12:46.3134139Z ##[debug]Processed: ##vso[task.setvariable variable=GitVersion.InformationalVersion;]1.2.1+4.Branch.master.Sha.xxx
2016-12-05T17:12:46.3134139Z ##[debug]Processed: ##vso[task.setvariable variable=GitVersion.BranchName;]master
2016-12-05T17:12:46.3144067Z ##[debug]Processed: ##vso[task.setvariable variable=GitVersion.Sha;]xxx
2016-12-05T17:12:46.3144067Z ##[debug]Processed: ##vso[task.setvariable variable=GitVersion.NuGetVersionV2;]1.2.1
2016-12-05T17:12:46.3144067Z ##[debug]Processed: ##vso[task.setvariable variable=GitVersion.NuGetVersion;]1.2.1
2016-12-05T17:12:46.3144067Z ##[debug]Processed: ##vso[task.setvariable variable=GitVersion.CommitsSinceVersionSource;]4
2016-12-05T17:12:46.3144067Z ##[debug]Processed: ##vso[task.setvariable variable=GitVersion.CommitsSinceVersionSourcePadded;]0004
2016-12-05T17:12:46.3144067Z ##[debug]Processed: ##vso[task.setvariable variable=GitVersion.CommitDate;]2016-12-05```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants