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

Allow a user to determine if they are logged into the BSR. #3414

Closed
zachgersh opened this issue Oct 21, 2024 · 1 comment · Fixed by #3416
Closed

Allow a user to determine if they are logged into the BSR. #3414

zachgersh opened this issue Oct 21, 2024 · 1 comment · Fixed by #3416
Assignees
Labels
Feature New feature or request

Comments

@zachgersh
Copy link

Feature

In my local workflow, I want to double check that a user has a netrc with credentials in it so they can be authenticated to the BSR. I use this check to make sure that a docker build does not fail on their machine since we are mounting their netrc in as a secret to do client downloads from BSR.

Change I'd like to see

The buf cli could probably have something like buf registry auth status or some similar commands that could tell you that you are logged in or not. The message that it prints isn't really important (could print the auth json) the more important part would be that it exits 0 if auth'ed and exits 1 if not auth'ed.

What does my bash code look like without this feature?

echo "Checking Buf Schema Registry login..."
bsr_auth_http_code=$(curl -o /dev/null -s -w "%{http_code}" -L -n {bsr_module_url}/@v/list)
if [ "$bsr_auth_http_code" -eq 200 ]; then
    echo "Successfully logged into BSR"
else
    echo "Please auth with the buf cli"
    exit 1
fi
echo -e "Done!\n"

buf curl could also work for this.

@zachgersh zachgersh added the Feature New feature or request label Oct 21, 2024
@zachgersh
Copy link
Author

happy to put a PR in for this feature as well as long as we agree on what the command is and the spec above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants