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

Publish as .NET Core Global Tool #1464

Closed
kll opened this issue Aug 30, 2018 · 9 comments
Closed

Publish as .NET Core Global Tool #1464

kll opened this issue Aug 30, 2018 · 9 comments

Comments

@kll
Copy link
Contributor

kll commented Aug 30, 2018

I think it would be a good idea to publish GitVersion as a .NET Core Global Tool.

I'm willing to do the work if it is agreed upon that it is a good idea. I haven't looked into it in detail yet but I assume it would probably need some outstanding work like #1445 and #1422 to get wrapped up first. It would obviously require getting actual stable releases out to nuget.org again. 😄

First order of business would be picking the name of the package. I'm personally pretty confused on what all the various GitVersion related packages already on nuget.org are for so I think some care to pick a good meaningful is important. I like what Cake did in v0.30.0 and suggest GitVersion.Tool for the package name. It's not taken but there is an existing GitVersion.Tools which might be confusing.

The end result would be easily installing GitVersion on any platform that supports .NET core with the following command:

dotnet tool install -g GitVersion.Tool

Then you can run it from anywhere with this command:

dotnet gitversion
@arturcic
Copy link
Member

arturcic commented Aug 30, 2018

What about naming the package as GitVersion.CommandLine.Tool or GitVersion.CommandLine.DotNetCore.Tool

@arodus
Copy link

arodus commented Aug 31, 2018

@kll

Then you can run it from anywhere with this command:
dotnet gitversion

The command would be just gitversion without the dotnet.

@dazinator
Copy link
Member

dazinator commented Sep 6, 2018

@arodus

The command would be just gitversion without the dotnet.

According to https://docs.microsoft.com/en-us/dotnet/core/tools/global-tools it could be run either way depending on how it's written!

I'd favour dotnet gitversion just because chocolatey package already puts gitversion on the PATH so it might get a bit confusing if people are running gitversion as to which one is being used (chocolatey versus global tool) - where as dotnet gitversion makes it obvious.

@arturcic - this would definitely be a welcomed PR but you are right those issues you linked are high on the agenda right now for obvious reasons

@kll
Copy link
Contributor Author

kll commented Sep 25, 2018

This is now part of #1422. Try it out with:
dotnet tool install -g --version 4.0.0-pullrequest1422-1625 --add-source https://ci.appveyor.com/nuget/gitversion-8nigugxjftrw GitVersion.CommandLine.DotNetCore.Tool

My personal preference for the tool Package Id to be something shorter and easier to remember though. :) Not a big deal because the end result once it's installed of dotnet gitversion is the exact same and that is easy enough to remember. :)

@kll
Copy link
Contributor Author

kll commented Sep 26, 2018

This works for me in Windows but not in Linux (Debian 9). It's the same LibGit2Sharp error I've seen before. I'll try to debug it but I'm a bit out of my depth.

System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception. ---> System.DllNotFoundException: Unable to load shared library 'git2-b0d9952' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libgit2-b0d9952: cannot open shared object file: No such file or directory
   at LibGit2Sharp.Core.NativeMethods.git_libgit2_init()
   at LibGit2Sharp.Core.NativeMethods.InitializeNativeLibrary()
   at LibGit2Sharp.Core.NativeMethods..cctor()
   --- End of inner exception stack trace ---
   at LibGit2Sharp.Core.NativeMethods.git_buf_free(GitBuf buf)
   at LibGit2Sharp.Core.Proxy.ConvertPath(Func`2 pathRetriever)
   at LibGit2Sharp.Repository.Discover(String startingPath)
   at GitVersion.GitPreparer.GetDotGitDirectory() in C:\projects\gitversion\src\GitVersionCore\GitPreparer.cs:line 163
   at GitVersion.GitPreparer.GetProjectRootDirectory() in C:\projects\gitversion\src\GitVersionCore\GitPreparer.cs:line 177
   at GitVersion.ConfigurationProvider.Verify(GitPreparer gitPreparer, IFileSystem fileSystem) in C:\projects\gitversion\src\GitVersionCore\Configuration\ConfigurationProvider.cs:line 268
   at GitVersion.Program.VerifyArgumentsAndRun()

@arturcic
Copy link
Member

please have a look here #1473

@kll
Copy link
Contributor Author

kll commented Sep 26, 2018

Well it actually worked fine for me with the official Debian 9 based dotnet:2.1-sdk Docker image. It was failing for me in a newly set up Debian 9 VM. After debugging things it turns out it was actually finding the libgit2-b0d9952.so correctly but that library needs libcurl.so.4 which was not present. I installed it by running sudo apt-get install libcurl3 and it started working.

Unrelated to the error but while I was poking around debugging it I noticed some extra stuff in the package.
content/GemAssets and contentFiles/any/netcoreapp2.1/GemAssets/.gitignore which I assume has something to do with the ruby gem and probably doesn't need to be included with the dotnet tool.

@TangoMikeOscar
Copy link

Hi just to voice my support for this, we are changing our build process over to be fully dotnet core compatible so we can build on linux and gitversion is our final hurdle with downloading tools via the dotnet tool install command line.

In regards to naming we currently use FAKE and Octopus Deploy Tools which have the package naming fake-cli and Octopus.DotNet.Cli respectively, so maybe something like GitVersion.DotNetCore.Cli is the way to go?

@arturcic
Copy link
Member

Closed by #1528

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

5 participants