buildbuddy-io / buildbuddy

BuildBuddy is an open source Bazel build event viewer, result store, remote cache, and remote build execution platform.

Home Page:https://buildbuddy.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[CLI] `bb login` should be a no-op if the user already has a valid API key

brentleyjones opened this issue · comments

Is your feature request related to a problem? Please describe.

bb login currently always opens a webpage, even if the user is logged in.

Describe the solution you'd like

bb login should instead do nothing when the user is logged it, probably with a message telling them they are already logged in.

Describe alternatives you've considered

We could check git config --local buildbuddy.api-key before calling bb login, but that only tells us if they have an API key set. It doesn't tell us if that key is valid. bb login should be able to do both of those steps, and only direct them to the web page if they need to do something there.

I think making bb login conditionally open the browser is a great idea!

However, I am a bit skeptical regarding making a network call to check the API Key validity.
A network call could be flaky and fail due to all sorts of reasons. 🤔

Let me check with the team to see if there is a better way.

Gentle ping on this. We would like to add bb login into a common flow of ours.

Sorry about that. My PR is going through review but folks are OOO 😅

I will try to push the fix forward for a release next week 🙇

This is being built and deployed now. Once it's done, you can use bb login --allow_existing to skip login if there is an existing, valid API key.