-
Notifications
You must be signed in to change notification settings - Fork 289
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
buf breaking
errors with workspaces containing different directories
#567
Comments
I did a bit more investigation into this one. At first glance, it seems like we can just merge the images and compare the current snapshot with the If we were to do this, we need a way to assign each configuration to different portions of the image, and each file contained in the image would only have a single configuration. This gets complicated in a variety of cases, such as files that are present in the current snapshot, but not in the I'll continue to look into this and see what we can do. |
I was just bitten by this in my Buf Gradle plugin integration. The way the plugin works is that it uses Buf to create a JSON image and then breakage checks run against images from previous versions. I recently modified the plugin to use workspaces with symlinks to protobuf source directories instead of copying protobuf source into a single directory and now breakage checks fail with this error, even when run against images generated by the same version (using workspaces with symlinks). Given that I want to check compatibility against a published artifact, is there a better way to achieve this workflow than publishing a JSON image with Buf itself? Should I just export the protobuf directories as an archive? I feel like this is a use case that images are intended for but I notice the documentation on using images for breakage checks seems to have vanished. Here's a branch with a failing test. The test can be executed by running The test runs against the sample project defined here and creates a temporary version: v1
directories:
- src-main-proto
- build-extracted--include--protos-main where |
I've explored a couple options for this. From what I can tell, you really just want to verify compatibility with respect to the compiled artifact (the image) created from the workspace as a whole - is that right? If you don't care about the potentially different For example, suppose that
If you are OK with the default
If you care about the individual
Those Depending on your configuration, you could merge the
Ideally all of this is automated behind the With all this said, I'll continue to investigate how we can implement this behavior to support all of these requirements, but hopefully this unblocks you in the meantime! |
I think I'm following what you're saying, but there's still a piece I don't understand. The |
What would be a graceful path to adding new directories to the |
It's not ideal, but you could adapt your workflow to always compare against Images (as described above). You could do it in a one-liner like so: $ buf build -o current.bin; buf build .git#branch=main -o against.bin; buf breaking current.bin --against against.bin This is only a problem if each of the directories in your Alternatively, you could compare compatibility between each of the directories listed in version: v1
directories:
- proto
- vendor GitHub Actions steps:
- uses: actions/checkout@v3
- uses: bufbuild/[email protected]
if: success()
with:
version: 1.1.0
- uses: bufbuild/[email protected]
if: success()
with:
input: proto
against: 'https://github.com/<your_org>/<your_repo>.git#branch=main,ref=HEAD~1,subdir=proto'
buf_token: ${{ secrets.BUF_TOKEN }}
- uses: bufbuild/[email protected]
if: success()
with:
input: vendor
against: 'https://github.com/<your_org>/<your_repo>.git#branch=main,ref=HEAD~1,subdir=vendor'
buf_token: ${{ secrets.BUF_TOKEN }} Custom Scriptfor directory in proto vendor; do
buf breaking ${directory} --against .git#branch=main,subdir=${directory}
done Then if you ever need to add another directory to your I admit that neither of these options are ideal, they are just workarounds for the time being. We'll try to have a better answer here soon, but other things have taken precedence. Please let us know if this helps you in the meantime! |
|
…no stdout (#241) This would allow the `buf breaking` [test that requires Buf 1.31.0](https://github.com/bufbuild/buf-gradle-plugin/pull/213/files#diff-dbe62edf00cb02d5ffc116d39393f9a9dd0a2f2cccb2d92b5f6d8ba529d16b03R19) to fail with an actual error message rather than silence. When this line is removed, the test now fails with the correct error message, which is this one: bufbuild/buf#567
Several users have been bitten by the "Failure: input contained 2 images, whereas against contained 1 images" error when running
buf breaking
with workspaces. Let's revisit this and see if we can do anything about it.The text was updated successfully, but these errors were encountered: