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

Print information after login #19029

Merged
merged 2 commits into from
Nov 7, 2023
Merged

Print information after login #19029

merged 2 commits into from
Nov 7, 2023

Conversation

csweichel
Copy link
Contributor

@csweichel csweichel commented Nov 7, 2023

Description

Once login is successful, we now print more details about the login user. It's essentially the same as running "Who am I?" right after the login.

Summary generated by Copilot

🤖 Generated by Copilot at cffb2f4

This pull request enhances the user experience of the local-app login and whoami commands. It adds more logging and feedback for the login command, and simplifies the code for both commands by using the context package and a shared helper function.

Related Issue(s)

Fixes EXP-886

How to test

gitpod login
image

Documentation

Preview status

gitpod:summary

Build Options

Build
  • /werft with-werft
    Run the build with werft instead of GHA
  • leeway-no-cache
  • /werft no-test
    Run Leeway with --dont-test
Publish
  • /werft publish-to-npm
  • /werft publish-to-jb-marketplace
Installer
  • analytics=segment
  • with-dedicated-emulation
  • workspace-feature-flags
    Add desired feature flags to the end of the line above, space separated
Preview Environment / Integration Tests
  • /werft with-local-preview
    If enabled this will build install/preview
  • /werft with-preview
  • /werft with-large-vm
  • /werft with-gce-vm
    If enabled this will create the environment on GCE infra
  • with-integration-tests=all
    Valid options are all, workspace, webapp, ide, jetbrains, vscode, ssh. If enabled, with-preview and with-large-vm will be enabled.
  • with-monitoring

/hold

@@ -66,7 +66,8 @@ var loginCmd = &cobra.Command{

err = auth.SetToken(loginOpts.Host, token)
if err != nil {
slog.Warn("could not write token to keyring, storing in config file instead", "err", err)
slog.Debug("could not write token to keyring, storing in config file instead")
Copy link
Contributor

Choose a reason for hiding this comment

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

Error is omitted 🙈

Copy link
Member

@filiptronicek filiptronicek left a comment

Choose a reason for hiding this comment

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

Works like a charm.

#19029 (comment) feels like worth addressing here, but otherwise :shipit:.

Comment on lines 43 to 44
// printWhoami prints information about the currently logged in user
func whoami(ctx context.Context, client *client.Gitpod, gpctx *config.ConnectionContext) ([]whoamiResult, error) {
Copy link
Member

Choose a reason for hiding this comment

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

nit: there's a mismatch between the function name and its doc

@@ -66,7 +66,8 @@ var loginCmd = &cobra.Command{

err = auth.SetToken(loginOpts.Host, token)
if err != nil {
slog.Warn("could not write token to keyring, storing in config file instead", "err", err)
slog.Debug("could not write token to keyring, storing in config file instead")
Copy link
Member

Choose a reason for hiding this comment

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

Could be worth checking slog.Level here to omit duplicate output.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe add a common function

@roboquat roboquat merged commit 7dfb884 into main Nov 7, 2023
15 checks passed
@roboquat roboquat deleted the cw/eng-886 branch November 7, 2023 20:47
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.

4 participants