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

release: package gcm as dotnet tool #886

Merged
merged 1 commit into from
Oct 13, 2022

Conversation

ldennington
Copy link
Contributor

@ldennington ldennington commented Sep 30, 2022

Package GCM as a dotnet tool and publish it to NuGet.org in release pipeline.

Note 1: The pipeline is currently set up to publish to my fork of GCM using a GitHub Packages Registry. Here are the instructions to dogfood from this registry:

  1. If you have GCM installed, uninstall it (you can find instructions for your distro/install method here).
  2. If you have not already installed dotnet, do so.
  3. Run the following:
export PATH="$PATH:~/.dotnet/tools"
dotnet tool install --global GitCredentialManager.Cli --add-source https://apiint.nugettest.org/v3/index.json
  1. If you have not already configured a credential store, follow these instructions to do so.

Note 2: We use a custom NuSpec file because, unfortunately, using Content in the .csproj to copy files would not overwrite the DotnetToolSettings.xml file. See NuGet/Home#9902 for details.

Fixes #820

Copy link
Contributor

@derrickstolee derrickstolee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a nice and clean result. I'm sure the journey to get here wasn't easy, but thanks for putting in that effort.

<!-- A "dummy" version is required, even though we override in csproj -->
<version>0.0.0</version>
<description>Secure, cross-platform Git credential storage with authentication to Azure Repos, GitHub, and other popular Git hosting services.</description>
<authors>The Git Fundamentals Team</authors>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we point to the gitcredentialmanager org instead of this team name?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure. This is unfortunately a required field, or else I would have removed it. Here's what the docs recommend:

authors
A comma-separated list of packages authors, matching the profile names on nuget.org. These are displayed in the NuGet Gallery on nuget.org and are used to cross-reference packages by the same authors.

Let me take a look at some other packages and think about what we want to do about this.

.github/workflows/release.yml Show resolved Hide resolved
@hickford hickford mentioned this pull request Oct 4, 2022
@hickford
Copy link
Contributor

hickford commented Oct 4, 2022

Exciting! Is there a .nupkg file to try out?

@hickford
Copy link
Contributor

hickford commented Oct 4, 2022

Package GCM for Linux as a dotnet tool

The package itself is cross platform, right?

@ldennington ldennington force-pushed the dotnet-tool branch 4 times, most recently from 001c80e to 7291505 Compare October 4, 2022 23:02
@ldennington
Copy link
Contributor Author

ldennington commented Oct 4, 2022

Exciting! Is there a .nupkg file to try out?

The best way to dogfood at the moment is to build a dummy version of the package and install it locally (it's only published to my fork's GitHub Packages registry at the moment which has some...issues). For the local install, from the root of your gcm repo run:

git fetch <your name for my fork>
git checkout dotnet-tool
dotnet build --configuration=LinuxRelease -o payload
./src/linux/Packaging.Linux/pack-tool.sh --version=1.2.3 --release=./out/linux/Packaging.Linux/payload/Release
dotnet tool install --global --add-source ./src/linux/Packaging.Linux/out/nupkg GitCredentialManager.Cli --prerelease

I will keep you posted with new instructions if we're able to resolve the GitHub registry issues.

Edit: Issues with my fork's registry are resolved! See the updated PR description for instructions to install.

@ldennington
Copy link
Contributor Author

Going to go ahead and promote this to a full PR - I feel good about our process for dogfooding from the registry while we wait to publish to NuGet.

@ldennington ldennington marked this pull request as ready for review October 5, 2022 18:24
@mjcheetham
Copy link
Collaborator

Package GCM for Linux as a dotnet tool

The package itself is cross platform, right?

This is not a cross platform package. It contains compiled/self-contained binaries specifically for Linux (the linux-x64 RID).

To make this a cross platform package we'd need to dotnet publish without --self-contained or any -r <RID> options, and also modify the code that locates and launches the UI helper executables to also try dotnet exec <helper>.dll if the self-contained executable version is not present.

However, the goal here with this change is to help Linux users specifically. For Windows and macOS we already have robust installation methods (via Git for Windows and Homebrew respectively), so the cross platform idea would be a future idea that we'd welcome community contribution for.

Copy link
Collaborator

@mjcheetham mjcheetham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks and works great (tested on one of my WSL instances)!

I had a few comments and questions around package metadata and which scripts are called on a dev box.

src/linux/Packaging.Linux/dotnet-tool.nuspec Outdated Show resolved Hide resolved
src/linux/Packaging.Linux/pack-tool.sh Outdated Show resolved Hide resolved
.github/workflows/release.yml Outdated Show resolved Hide resolved
src/linux/Packaging.Linux/pack-tool.sh Outdated Show resolved Hide resolved
@hickford
Copy link
Contributor

hickford commented Oct 6, 2022

Here are the instructions to dogfood from this registry

Installed successfully. Tested git push to GitHub.

Package size is 147 MB (too big to upload here). Install size is 493 MB.

Diagnostic "Microsoft authentication (AAD/MSA)" failed:

System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Identity.Client.Extensions.Msal, Version=2.19.2.0, Culture=neutral, PublicKeyToken=0a613f4dd989e8ae'. The system cannot find the file specified.

@hickford
Copy link
Contributor

hickford commented Oct 6, 2022

Package size is 147 MB, install size is 493 MB.

For me, that's prohibitively big. I want to use GCM everywhere I use Git including where disk space is precious. Git is 35 MB. The .NET runtime is 70 MB. Have you considered omitting the UI helpers? Advantages:

  1. Small install size (5 MB)
  2. Cross platform (in particular supporting linux-arm64, on which otherwise difficult to install GCM)

@ldennington
Copy link
Contributor Author

ldennington commented Oct 7, 2022

Package size is 147 MB, install size is 493 MB.

For me, that's prohibitively big. I want to use GCM everywhere I use Git including where disk space is precious. Git is 35 MB. The .NET runtime is 70 MB. Have you considered omitting the UI helpers? Advantages:

  1. Small install size (5 MB)
  2. Cross platform (in particular supporting linux-arm64, on which otherwise difficult to install GCM)

@mjcheetham and I talked this over. The best path forward is probably to go ahead and make this cross-plat and update the way we call the helper exes. Hopefully no longer bundling the runtime multiple times will bring this down to an acceptable size. Planning to get as far as I can on this today.

@hickford: A new package has been pushed to my registry (GitCredentialManager.Cli version 2.0.807) that is cross-platform compatible and has a much smaller .nupkg size of 53.1 MB. I'm curious, how did you measure the install size? I'd like to compare that as well.

@ldennington ldennington changed the title release: package linux releases as dotnet tool release: package gcm as dotnet tool Oct 11, 2022
@ldennington ldennington force-pushed the dotnet-tool branch 4 times, most recently from 27f8911 to 94439b7 Compare October 12, 2022 17:54
@ldennington
Copy link
Contributor Author

@mjcheetham @hickford - I believe this is now in a state where it's prepared for final review.

Copy link
Collaborator

@mjcheetham mjcheetham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall this looks and works great from my testing! 🎉

I've left some comments about how we locate and execute the .dll framework-dependent UI helpers.

src/shared/Core/Authentication/AuthenticationBase.cs Outdated Show resolved Hide resolved
src/shared/Core/Authentication/AuthenticationBase.cs Outdated Show resolved Hide resolved
src/shared/Core/Authentication/AuthenticationBase.cs Outdated Show resolved Hide resolved
@ldennington ldennington force-pushed the dotnet-tool branch 2 times, most recently from 581d57d to c0a3efa Compare October 12, 2022 23:33
Copy link
Collaborator

@mjcheetham mjcheetham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 This is great! Sorry for the bad patches I sent you off-PR.. 😞

src/shared/Core/Authentication/AuthenticationBase.cs Outdated Show resolved Hide resolved
Add a new `DotnetTool` project containing the needed files to publish GCM
as a cross-platform dotnet tool. Additionally, update GCM to use helper
dlls if exes are not found in the Application directory. At present, dlls
are only used in the dotnet tool scenario to minimize the package size and
to make it cross-platform compatible.
@ldennington ldennington merged commit 89b565a into git-ecosystem:main Oct 13, 2022
@ldennington ldennington mentioned this pull request Nov 3, 2022
ldennington added a commit that referenced this pull request Nov 3, 2022
Changes:

- Check for broken links in documentation (#700)
- Support macOS `arm64` installs via Homebrew (#798) 
- Validate installers before publishing (#813)
- Auto-generate maintainer away notification issues (#842)
- Install dotnet via Jammy feeds on Ubuntu 22.04 and greater (#839)
- Access Azure storage account using service principle credentials
(#851)
- Update documentation to use reference-style links (#680)
- Unify documentation line length (#862)
- Add generic username/password UI (#871)
- Bitbucket DC OAuth support (#607)
- Distribute GCM as a dotnet tool (#886)
- Drop `-core` suffix from entry executable #551 
- Speed up build graph (#924)
@hickford
Copy link
Contributor

@hickford: A new package has been pushed to my registry (GitCredentialManager.Cli version 2.0.807) that is cross-platform compatible and has a much smaller .nupkg size of 53.1 MB. I'm curious, how did you measure the install size? I'd like to compare that as well.

@ldennington Opened #1212 with measurement details

@Sandman1225737

This comment was marked as spam.

@mohamadfaqani

This comment was marked as spam.

@ldennington ldennington deleted the dotnet-tool branch July 12, 2023 18:27
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

Successfully merging this pull request may close these issues.

dotnet tool install git-credential-manager
6 participants