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

Add rule to create buf image #151

Open
aaliddell opened this issue Oct 2, 2021 Discussed in #150 · 5 comments
Open

Add rule to create buf image #151

aaliddell opened this issue Oct 2, 2021 Discussed in #150 · 5 comments
Labels
enhancement New feature or request lang-buf Buf rules specific

Comments

@aaliddell
Copy link
Member

Discussed in #150

Originally posted by sschnug October 2, 2021
Hi,

after having taken some first (successfull) experiments with this tool, i wanted to have a look at buf_proto_breaking_test.

I wonder how it's meant to be used.

The concept of some image was unclear to me, but buf's doc helped.

Now if i understand correctly, i need to prepare some image of my last commit (or better: cache them) and can then use buf_proto_breaking_test with my current commit based input protos against this image.

The strange thing, to me, it that i don't see any functionality within rules_proto_grpc to produce this image.

One probably could carefully follow bufs docs and create those, but i would be scared about being correct then as this tool here takes care of all those protoc invocations and generating images needed for this tasks also looks like one more protoc invocation.

Shouldn't there be a rule / feature whose task is to produce a image giving some compatible input as buf_proto_breaking_test uses?

Thanks for reading,
Sascha

@aaliddell aaliddell added enhancement New feature or request lang-buf Buf rules specific labels Oct 2, 2021
@aaliddell aaliddell mentioned this issue Oct 3, 2021
@noel-yap
Copy link

@aaliddell , would you have an ETA for this (on the order of days, weeks, months, quarters)? I'd like to know so I can prioritize my work or possibly implement a hacky solution until it's officially supported.

@aaliddell
Copy link
Member Author

I would expect minimum weeks. I may get a chance to look before the end of the year, but more likely early next year.

I have tried looking at implementing this, but it doesn't quite fit with the existing rules we have, so needs some rework of the rule internals to avoid almost-duplicate implementations.

@noel-yap
Copy link

noel-yap commented May 6, 2022

Any update on this?

@noel-yap
Copy link

I think bufbuild/buf#1121 is related to this work. Considering the inconsistencies with how buf build and buf breaking treat the --path option and the current working directory, instead of using the bazel rules, I'm creating a script that'll create a buf workspace. After setup, it'll essentially do:

(
  cd "${BUF_TMPDIR}"

  # `buf breaking` is called directly instead of `bazel test` due to the directory structure
  test "${FORCE_OPTION}" = '--force' ||
      test ! -e "${BUF_IMAGE_JSON_FILE}" ||
      (
        set -e;
        cd "${APP}";
        buf --timeout=1m breaking --against="../$(basename "${BUF_IMAGE_JSON_FILE}")" "${BREAKING_PROTOS[@]/#/--path=}";
      ) &&
      buf --timeout=1m build --exclude-imports --as-file-descriptor-set -o "${BUF_IMAGE_JSON_FILE}" "${BUILD_PROTOS[@]/#/--path=}"
)

@codersasha
Copy link
Contributor

Related: #211

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request lang-buf Buf rules specific
Projects
None yet
Development

No branches or pull requests

3 participants