GitVersion method is taking too much time to complete

Hello,

I am using build.cake in Teamcity. The GitVersion method in it is taking too long to complete and to get the version number. it is taking more than 30mins, sometimes 50 long mins. It has been seen that even when it is building for develop branch it is fetching all feature or bug branches which the dev team has created to calculate the build version number, I think which is not required. It is really time consuming. How to reduce this execution time and get version quickly? Is there any way we can optimize the gitversion method or any setting in Teamcity to get it faster? Please check the below image. 

Please help here. Any help would be appreciated.

Thanks.

0
3 comments

Hi,

We may optimize this in two ways:

1. Improve GitVersion Configuration:

Remove unnecessary branches or commits from the repository to improve GitVersion's performance. Example configuration:

ignore:
  sha: []
  commits-before: 2023-01-01

Note: you can change the date as your requirement.

2. Run GitVersion as a separate pipeline or on a schedule to precompute versions.

Set up a build configuration to calculate the version information. Other builds can then depend on this configuration to retrieve the version details. For more detailed information, please refer to Configuring Dependencies and Use Parameters in Build Chains.

 

Best Regards,

Tom

0

Thanks, Tom, for your reply.

Now if I use “commits-before: 2023-01-01” then is it like the commits that had been done before the date will be taken into build process? So then is it possible that this may break the functionality of the code if it is not taking the codes committed before the date? 

0
Hi,

Using commits-before without proper consideration could break your code if critical changes are excluded. Use this filter cautiously and only when you need to build a specific state of the repository.

Best Regards,
Tom
0

Please sign in to leave a comment.