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

Suggest using ggshield config set instance at login #684

Merged
merged 2 commits into from
Aug 11, 2023

Conversation

agateau-gg
Copy link
Collaborator

Context

To login on an instance other than the default instance, users pass the --instance INSTANCE_URL option to ggshield auth login. This does not make INSTANCE_URL the default instance though, leading to confusion.

This PR makes ggshield auth login print a message suggesting to use ggshield config set instance INSTANCE_URL when auth login is called with --instance.

What has been done

  • Turn Config.set_cmdline_instance() into a cmdline_instance property
  • Add the message

Demo

Logging in on the default instance, no message:

$ ggshield auth login --method token
Enter your GitGuardian API token: 
Authentication was successful.

Logging in on a custom instance, suggestion message is printed:

$ ggshield auth login --method token --instance https://example.com
Enter your GitGuardian API token: 
Authentication was successful.

To make ggshield always use this instance, run "ggshield config set instance https://example.com".

@agateau-gg agateau-gg requested review from Walz and removed request for Walz August 11, 2023 10:00
@codecov-commenter
Copy link

codecov-commenter commented Aug 11, 2023

Codecov Report

Merging #684 (e53da9d) into main (608230e) will increase coverage by 0.04%.
Report is 2 commits behind head on main.
The diff coverage is 100.00%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@            Coverage Diff             @@
##             main     #684      +/-   ##
==========================================
+ Coverage   93.05%   93.09%   +0.04%     
==========================================
  Files         128      128              
  Lines        5698     5705       +7     
==========================================
+ Hits         5302     5311       +9     
+ Misses        396      394       -2     
Flag Coverage Δ
unittests 93.09% <100.00%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
ggshield/cmd/auth/login.py 96.38% <100.00%> (+0.55%) ⬆️
ggshield/core/config/config.py 97.14% <100.00%> (+0.11%) ⬆️
ggshield/core/oauth.py 86.36% <100.00%> (-0.13%) ⬇️

... and 1 file with indirect coverage changes

@agateau-gg agateau-gg requested a review from Walz August 11, 2023 12:23
@agateau-gg agateau-gg merged commit c9573e1 into main Aug 11, 2023
22 checks passed
@agateau-gg agateau-gg deleted the agateau/auth-login-msg branch August 11, 2023 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants