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

Extend the buf registry sdk command to reverse versions into module and reference #3485

Open
KenxinKun opened this issue Nov 20, 2024 · 2 comments
Labels
Feature New feature or request

Comments

@KenxinKun
Copy link

Feature

Today we can do:

$ buf registry sdk version --module=buf.build/connectrpc/eliza --plugin=buf.build/protocolbuffers/go
v1.33.0-20230913231627-233fca715f49.1

However we cannot do the reverse operation.

I am presented with the challenge that I want to use buf export for all the Go imports from the BSR in my go.mod file, for example:

go 1.23.0

require (
	buf.build/gen/go/acme/paymentapis/protocolbuffers/go v1.35.2-20220907172603-9a877cf260e1.1
)

I tried doing buf export buf.build/acme/paymentapis:main -o ./temp and it works with the latest, however if I try
buf export buf.build/acme/paymentapis:9a877cf260e1 -o ./temp with the short sha it fails with resource not found.

Is there a way to get exactly the version in the go.mod?

@KenxinKun KenxinKun added the Feature New feature or request label Nov 20, 2024
@doriable doriable changed the title Extend the bug registry sdk command to reverse versions into module and reference Extend the buf registry sdk command to reverse versions into module and reference Nov 20, 2024
@doriable
Copy link
Member

I discussed this proposal and the point brought up about resolving a short SHA for buf commands.
We unfortunately do not have the bandwidth right now to pursue either of these options, however, I might be able to provide some workarounds that can help with this.

If you are already able to parse the SDK name from buf.build/gen/go/acme/paymentapis/protocolbuffers/go v1.35.2-20220907172603-9a877cf260e1.1 to the module buf.build/acme/paymentapis with the short SHA for the commit 9a877cf260e1, you can use buf registry module commit to query for the commit.

For example, the following provides a list of the commits on buf.build/acme/paymentapis that I then piped into jq, and this list can be used to find the commit with the prefix 9a877cf260e1:

$ buf registry module commit list buf.build/acme/paymentapis --format json | jq .commits.[]?.commit
"9a877cf260e1488d869a31fce3bea26d"
"2675d6a595ac4e0fb45cedc62edfc611"

Let me know if this workaround can help at least unblock you and if you have any other questions.

@KenxinKun
Copy link
Author

Hi @doriable thanks for the suggestion I'll try it out!

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

No branches or pull requests

2 participants