Skip to content

build image rule #43

Open
Open

Description

@ns-ggeorgiev

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.

Activity

  1. srikrsna-buf commented on Nov 6, 2023

    @srikrsna-buf
    Contributor

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

  2. ns-ggeorgiev commented on Nov 6, 2023

    @ns-ggeorgiev
    Author

    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"],
    )
    
  3. srikrsna-buf commented on Nov 6, 2023

    @srikrsna-buf
    Contributor

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

  4. ns-ggeorgiev commented on Nov 6, 2023

    @ns-ggeorgiev
    Author

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

  5. srikrsna-buf commented on Nov 7, 2023

    @srikrsna-buf
    Contributor

    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?

  6. ns-ggeorgiev commented on Nov 7, 2023

    @ns-ggeorgiev
    Author

    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.

  7. srikrsna-buf commented on Nov 7, 2023

    @srikrsna-buf
    Contributor

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

  8. ns-ggeorgiev commented on Nov 7, 2023

    @ns-ggeorgiev
    Author

    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

  9. srikrsna-buf commented on Nov 7, 2023

    @srikrsna-buf
    Contributor

    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.

  10. ns-ggeorgiev commented on Nov 7, 2023

    @ns-ggeorgiev
    Author

    yes, that will be great

  11. chandraaditya commented on Feb 23, 2024

    @chandraaditya

    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?

  12. srikrsna-buf commented on Feb 26, 2024

    @srikrsna-buf
    Contributor

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

  13. srikrsna-buf commented on May 7, 2025

    @srikrsna-buf
    Contributor

    To create a buf_build rule for v2 we will need bazelbuild/bazel#7989. I have an implementation that works with v1 config in a branch.

    In the meantime, you can run buf from bazel:

    bazel run @rules_buf_toolchains//:buf -- build --disable-symlinks -o image.bin
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions