bufbuild / buf

The best way of working with Protocol Buffers.
https://buf.build
Apache License 2.0
9.08k stars 276 forks source link

`buf breaking` fails when BSR tag for library doesn't exist (when run from Docker) #1405

Closed ccampo133 closed 1 year ago

ccampo133 commented 2 years ago

In response to https://github.com/bufbuild/buf/issues/1380, I recently ran buf mod update to update some googleapis dependency references in various repositories. However, we have a GH Action which runs buf breaking against the main branch on each PR, which now fails because the googleapis tag referenced in the main branch's buf.lock file no longer exists.

$ docker run --volume "$(pwd):/workspace" --workdir /workspace bufbuild/buf:1.8.0 -v breaking --against ".git#branch=main,subdir=proto"
buf: downloading buf.build/envoyproxy/protoc-gen-validate:45685e052c7e406b9fbd441fc7a568a5
buf: downloading buf.build/googleapis/googleapis:8d7204855ec14631a499bd7393ce1970
buf: downloading buf.build/grpc-ecosystem/grpc-gateway:bc28b723cd774c32b6fbc77621518765
buf: downloading buf.build/googleapis/googleapis:80720a488c9a414bb8d4a9f811084989
Failure: buf.build/googleapis/googleapis:80720a488c9a414bb8d4a9f811084989: does not exist

I created a small repository to demonstrate this here:

I believe I understand why this does not work after reading https://github.com/bufbuild/buf/issues/1380, however getting to that point of understanding was quite unintuitive. Perhaps buf breaking should be more resilient to these types of situation? At the very least, and improved error message would be helpful.

Thanks very much.

bufdev commented 2 years ago

This seems to be working as intended here: what buf breaking is doing is building your git repository at .git on the branch main in the sub-directory proto, so it will take anything that is there and attempt to build it, just as it would if it were running buf build .git#branch=main,subdir=proto. When building, it ran into the error Failure: buf.build/googleapis/googleapis:80720a488c9a414bb8d4a9f811084989: does not exist, as this reference is likely what you have at the head of your main branch. What would you propose buf breaking do in this situation?

ccampo133 commented 2 years ago

I agree, after understanding the issue, I don't think there is anything that can really be done from an operational standpoint to resolve this error. However perhaps if the error message could elucidate what went wrong, similar to how your comment did, it would have given me more of a lead to work on. So perhaps my issue is simply with the error message, as it appeared quite vague. I'm certainly not the best in coming up with good error messages though, so I fear I don't have anything else to contribute.

Please feel free to close this issue - hopefully my feedback as a user is helpful in some way.