GitVersion slow performance
Asked Answered
C

1

7

The GitVersion step of our CI build now takes 4-5 minutes and we can't really figure out why. Here are some basic logs:

2018-09-25T14:31:02.4222252Z ##[section]Starting: GitVersion
2018-09-25T14:31:02.4227925Z ==============================================================================
2018-09-25T14:31:02.4228168Z Task         : GitVersion Task
2018-09-25T14:31:02.4228396Z Description  : Easy Semantic Versioning (http://semver.org) for projects using Git
2018-09-25T14:31:02.4228654Z Version      : 3.6.5
2018-09-25T14:31:02.4229010Z Author       : GitVersion Contributors
2018-09-25T14:31:02.4229302Z Help         : See the [documentation](http://gitversion.readthedocs.org/en/latest/) for help
2018-09-25T14:31:02.4229565Z ==============================================================================
2018-09-25T14:31:02.4366228Z Preparing task execution handler.
2018-09-25T14:31:02.6709097Z Executing the powershell script: d:\w\_tasks\GitVersion_e5983830-3f75-11e5-82ed-81492570a08e\3.6.5\GitVersion.ps1
2018-09-25T14:31:03.0124372Z Current Directory:  D:\w\_tasks\GitVersion_e5983830-3f75-11e5-82ed-81492570a08e\3.6.5
2018-09-25T14:31:03.0124924Z 
2018-09-25T14:31:03.0125184Z 
2018-09-25T14:31:03.0130879Z Sources Directory:  d:\w\1\s
2018-09-25T14:31:03.0131239Z 
2018-09-25T14:31:03.0131454Z 
2018-09-25T14:31:03.0230450Z Invoking GitVersion with d:\w\1\s /output buildserver /nofetch
2018-09-25T14:31:03.0231023Z 
2018-09-25T14:31:03.0231265Z 
2018-09-25T14:31:03.0285337Z D:\w\_tasks\GitVersion_e5983830-3f75-11e5-82ed-81492570a08e\3.6.5\GitVersion.exe d:\w\1\s /output buildserver /nofetch
2018-09-25T14:31:03.1207954Z INFO [09/25/18 14:31:03:10] Working directory: d:\w\1\s
2018-09-25T14:31:03.1208779Z INFO [09/25/18 14:31:03:10] IsDynamicGitRepository: False
2018-09-25T14:31:03.1344488Z INFO [09/25/18 14:31:03:12] Returning Project Root from DotGitDirectory: d:\w\1\s\.git - d:\w\1\s
2018-09-25T14:31:03.1380473Z INFO [09/25/18 14:31:03:12] Running on Windows.
2018-09-25T14:31:03.1438147Z INFO [09/25/18 14:31:03:13] Applicable build agent found: 'VsoAgent'.
2018-09-25T14:31:03.1442989Z INFO [09/25/18 14:31:03:13] Branch from build environment: refs/heads/develop
2018-09-25T14:32:49.2277821Z INFO [09/25/18 14:32:49:22] IsDynamicGitRepository: False
2018-09-25T14:32:49.2281217Z INFO [09/25/18 14:32:49:22] Returning Project Root from DotGitDirectory: d:\w\1\s\.git - d:\w\1\s
2018-09-25T14:32:49.2281501Z INFO [09/25/18 14:32:49:22] Project root is: d:\w\1\s
2018-09-25T14:32:49.2281789Z INFO [09/25/18 14:32:49:22] DotGit directory is: d:\w\1\s\.git
2018-09-25T14:32:49.4925166Z INFO [09/25/18 14:32:49:47] IsDynamicGitRepository: False
2018-09-25T14:32:49.4926214Z INFO [09/25/18 14:32:49:47] Returning Project Root from DotGitDirectory: d:\w\1\s\.git - d:\w\1\s
2018-09-25T14:32:49.5009080Z INFO [09/25/18 14:32:49:49] Begin: Loading version variables from disk cache
2018-09-25T14:32:49.5014606Z   INFO [09/25/18 14:32:49:49] Cache file d:\w\1\s\.git\gitversion_cache\EDAA5BA150AAFFAFF7ABE57C2BFD74AA4AA3B217.yml not found.
2018-09-25T14:32:49.5021815Z INFO [09/25/18 14:32:49:49] End: Loading version variables from disk cache (Took: 0.00ms)
2018-09-25T14:32:49.5029581Z INFO [09/25/18 14:32:49:49] IsDynamicGitRepository: False
2018-09-25T14:32:49.5030888Z INFO [09/25/18 14:32:49:49] Returning Project Root from DotGitDirectory: d:\w\1\s\.git - d:\w\1\s
2018-09-25T14:32:49.5151471Z INFO [09/25/18 14:32:49:50] Using latest commit on specified branch
2018-09-25T14:32:50.2769177Z INFO [09/25/18 14:32:50:27] Running against branch: develop (c7dfbbf862e9681bea20563bd4591f004ee74f0d)
2018-09-25T14:32:50.2862740Z INFO [09/25/18 14:32:50:27] Begin: Calculating base versions
2018-09-25T14:32:50.5260304Z   INFO [09/25/18 14:32:50:52] Fallback base version: 0.1.0 with commit count source ed0e73ed52b1f271e3914267b510b5dd230eedce
2018-09-25T14:33:02.7492807Z   INFO [09/25/18 14:33:02:74] Git tag 'v0.5.0-unstable.3243': 0.5.0-unstable.3243 with commit count source 63ee9c744ab7eeec6ea313f9630087b7c4cde4f1
2018-09-25T14:33:02.7607508Z   INFO [09/25/18 14:33:02:75] Git tag 'v0.5.0-unstable.3240': 0.5.0-unstable.3240 with commit count source d71d3d708b84252ad53f256000279142e9288687
2018-09-25T14:33:02.7698133Z   INFO [09/25/18 14:33:02:75] Git tag 'v0.5.0-ie11-clipboard.9+3256': 0.5.0-ie11-clipboard.9+3256 with commit count source 438fd61e9a4ee18abd55f956764a92595097be45

... for about 3000 lines ...

2018-09-25T14:33:54.1517668Z   INFO [09/25/18 14:33:54:14] Git tag 'v0.1.0-unstable.1736': 0.1.0-unstable.1736 with commit count source 1469b1d1b38e7113ff765b3d591d42529f03f03a
2018-09-25T14:33:54.1734453Z   INFO [09/25/18 14:33:54:16] Git tag 'v0.1.0-unstable.1735': 0.1.0-unstable.1735 with commit count source 5375858e279e253fc4578af8b0be29d5b4269e3e
2018-09-25T14:33:54.2005144Z   INFO [09/25/18 14:33:54:19] Git tag 'v0.1.0-unstable.1734': 0.1.0-unstable.1734 with commit count source 63b6ad54121d9e4d06ddac4e80eda3f9f5709763
2018-09-25T14:34:09.7603293Z   INFO [09/25/18 14:34:09:75] Merge target tagged 'v0.5.0-unstable.3243': 0.5.0-unstable.3243 with commit count source 63ee9c744ab7eeec6ea313f9630087b7c4cde4f1
2018-09-25T14:34:09.7706672Z   INFO [09/25/18 14:34:09:75] Merge target tagged 'v0.5.0-unstable.3240': 0.5.0-unstable.3240 with commit count source d71d3d708b84252ad53f256000279142e9288687
2018-09-25T14:34:09.7805193Z   INFO [09/25/18 14:34:09:77] Merge target tagged 'v0.5.0-ie11-clipboard.9+3256': 0.5.0-ie11-clipboard.9+3256 with commit count source 438fd61e9a4ee18abd55f956764a92595097be45

... for about 4000 lines like these ...

2018-09-25T14:35:13.8552137Z   INFO [09/25/18 14:35:13:85] Merge target tagged 'v0.1.0-unstable.1736': 0.1.0-unstable.1736 with commit count source 1469b1d1b38e7113ff765b3d591d42529f03f03a
2018-09-25T14:35:13.8851950Z   INFO [09/25/18 14:35:13:88] Merge target tagged 'v0.1.0-unstable.1735': 0.1.0-unstable.1735 with commit count source 5375858e279e253fc4578af8b0be29d5b4269e3e
2018-09-25T14:35:13.9069833Z   INFO [09/25/18 14:35:13:89] Merge target tagged 'v0.1.0-unstable.1734': 0.1.0-unstable.1734 with commit count source 63b6ad54121d9e4d06ddac4e80eda3f9f5709763
2018-09-25T14:35:14.1701044Z   INFO [09/25/18 14:35:14:16] Merge message 'Merge remote-tracking branch 'origin/release/v0.4.4' into develop': 0.4.4 with commit count source 081fe710a28ef0698520cc71c04ab4dd84028cbb
2018-09-25T14:35:14.1845666Z   INFO [09/25/18 14:35:14:18] Merge message 'Merge branch 'release/v0.4.4' into develop': 0.4.4 with commit count source 46869edcecde68f5dc6d48721f0f4bb33b966932
2018-09-25T14:35:14.2046186Z   INFO [09/25/18 14:35:14:19] Merge message 'Merge branch 'release/v0.4.4' of https://Company.visualstudio.com/Project/_git/GitRepo into release/v0.4.4': 0.4.4 with commit count source 407eea8e4dc3e779bc29359c39366e92f74db3dc
2018-09-25T14:35:14.2204322Z   INFO [09/25/18 14:35:14:21] Merge message 'Merge branch 'hotfix/0.4.3'': 0.4.3 with commit count source 7e520eefc12c7aae61576fefba9aecb733259fdd
2018-09-25T14:35:14.2360008Z   INFO [09/25/18 14:35:14:22] Merge message 'Merge branch 'hotfix/0.4.3' into develop': 0.4.3 with commit count source aa1bf7038192e1e43c5922997e9c7deee32365bb
2018-09-25T14:35:14.2505000Z   INFO [09/25/18 14:35:14:24] Merge message 'Merge remote-tracking branch 'origin/release/v0.4.1' into develop': 0.4.1 with commit count source a00395b8c59b7bc0f1b4f6b2e15a69d779f00be5
2018-09-25T14:35:14.2754392Z   INFO [09/25/18 14:35:14:27] Found multiple base versions which will produce the same SemVer (0.5.0), taking oldest source for commit counting (Merge message 'Merge branch 'hotfix/0.4.3' into develop')
2018-09-25T14:35:14.2754999Z   INFO [09/25/18 14:35:14:27] Base version used: Merge message 'Merge remote-tracking branch 'origin/release/v0.4.1' into develop': 0.4.1 with commit count source aa1bf7038192e1e43c5922997e9c7deee32365bb
2018-09-25T14:35:14.2755712Z INFO [09/25/18 14:35:14:27] End: Calculating base versions (Took: 144,000.01ms)
2018-09-25T14:35:15.0181063Z INFO [09/25/18 14:35:15:00] 3280 commits found between aa1bf7038192e1e43c5922997e9c7deee32365bb and c7dfbbf862e9681bea20563bd4591f004ee74f0d
2018-09-25T14:35:15.0446700Z INFO [09/25/18 14:35:15:03] Begin: Creating dictionary
2018-09-25T14:35:15.0478209Z INFO [09/25/18 14:35:15:03] End: Creating dictionary (Took: 0.00ms)
2018-09-25T14:35:15.0503865Z INFO [09/25/18 14:35:15:03] Begin: Storing version variables to cache file d:\w\1\s\.git\gitversion_cache\EDAA5BA150AAFFAFF7ABE57C2BFD74AA4AA3B217.yml
2018-09-25T14:35:15.1043234Z INFO [09/25/18 14:35:15:10] End: Storing version variables to cache file d:\w\1\s\.git\gitversion_cache\EDAA5BA150AAFFAFF7ABE57C2BFD74AA4AA3B217.yml (Took: 62.50ms)
2018-09-25T14:35:15.1109747Z INFO [09/25/18 14:35:15:10] Applicable build agent found: 'VsoAgent'.
2018-09-25T14:35:15.1119265Z Executing GenerateSetVersionMessage for 'VsoAgent'.
2018-09-25T14:35:15.2560540Z Executing GenerateBuildLogOutput for 'VsoAgent'.
2018-09-25T14:35:15.2633144Z ##[section]Async Command Start: Update Build Number
2018-09-25T14:35:15.4482707Z Update build number to 0.5.0-unstable.3280 for build 6560
2018-09-25T14:35:15.4483044Z ##[section]Async Command End: Update Build Number
2018-09-25T14:35:15.4484260Z ##[section]Finishing: GitVersion

This is a VSTS build. We are using what we think is GitFlow. Feature branches are sometimes deleted, sometimes not. Maybe there is some cleanup to do here.

Any ideas as to why this is taking so long to execute?

Cool answered 25/9, 2018 at 14:50 Comment(0)
S
3

Are you using mainline and seldom create tags to set versions?

If so, try to set a version every now and then with a tag. Otherwise gitversion will go through a lot of history to calculate the version.

https://gitversion.readthedocs.io/en/latest/reference/mainline-development/#mainline-development

Seafowl answered 31/10, 2019 at 12:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.