rules_buf icon indicating copy to clipboard operation
rules_buf copied to clipboard

build image rule

Open ns-ggeorgiev opened this issue 1 year ago • 12 comments

I think having a bazel rule that can create the buf image for a target is going to be extremely useful. Without it, I have to repeat all the bazel config in order to build the image.

ns-ggeorgiev avatar Oct 24 '23 16:10 ns-ggeorgiev

Could you elaborate a bit more how such a rule will work? Like how do you expect dependencies to be resolved?

srikrsna-buf avatar Nov 06 '23 16:11 srikrsna-buf

if I can use the lint test as follows:

buf_lint_test(
    name = "ghjira_proto_lint",
    config = "//:buf.yaml",
    targets = [":ghjira_proto"],
)

I would like to be able to have the ability to create image with the same ease:

buf_image(
    name = "ghjira_proto_image",
    targets = [":ghjira_proto"],
)

ns-ggeorgiev avatar Nov 06 '23 16:11 ns-ggeorgiev

Hey! In you example the target :ghjira_proto which comes from proto_library already has the file descriptor set

srikrsna-buf avatar Nov 06 '23 17:11 srikrsna-buf

@srikrsna-buf How this relates to having a buf image?

ns-ggeorgiev avatar Nov 06 '23 18:11 ns-ggeorgiev

Images are an extension of file descriptor sets. In the example that you proposed they are more or less the same. The one missing piece is the module info which will have information of the module this belongs to.

We have an unreleased push rule perhaps you are looking for something similar that builds the image?

srikrsna-buf avatar Nov 07 '23 03:11 srikrsna-buf

I am looking for rule that can generate the file that I can store and later pass to the buf-breaking-test as against argument.

ns-ggeorgiev avatar Nov 07 '23 04:11 ns-ggeorgiev

If it is a rule then it will always build from the same source as buf_breaking_test and never detect any breaking changes.

srikrsna-buf avatar Nov 07 '23 04:11 srikrsna-buf

I am not going to use the result for the rule form the current version, I am going to use the output of the rule to store in location from where I can pull it for the next execution

ns-ggeorgiev avatar Nov 07 '23 04:11 ns-ggeorgiev

Okay, sounds good so you need a rule that builds the image for all you proto files as a single module, I think it will look similar to the push rule that I linked.

srikrsna-buf avatar Nov 07 '23 04:11 srikrsna-buf

yes, that will be great

ns-ggeorgiev avatar Nov 07 '23 04:11 ns-ggeorgiev

I'm looking for such a rule as well for the exact same reason. Any update on if we can get that and if so when?

chandraaditya avatar Feb 23 '24 23:02 chandraaditya

We are in the midst of some change to how build works, waiting for them to land before we add this rule.

srikrsna-buf avatar Feb 26 '24 20:02 srikrsna-buf