-
Notifications
You must be signed in to change notification settings - Fork 347
Allow a user to determine if they are logged into the BSR. #3414
Copy link
Copy link
Closed
Labels
FeatureNew feature or requestNew feature or request
Description
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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
FeatureNew feature or requestNew feature or request