opiproject / opi-api

Open Programmable Infrastructure API and Behavioral Model
Apache License 2.0
32 stars 40 forks source link

refactor(network): updates to support buf lint and generation in opin… #404

Closed sandersms closed 10 months ago

sandersms commented 10 months ago

…etcommon.

This switches the generation of the protobuf files for go and python to use "buf generate" instead of standard protoc. The makefile is updated to support buf lint, buf generate, and document generation.

sandersms commented 10 months ago

Note that buf generate can't be run in a docker container due to protoc not being included.

artek-koltun commented 10 months ago

Note that buf generate can't be run in a docker container due to protoc not being included.

Using the Docker image offers numerous advantages (consistent build env, pinned tool version etc.). In case it's not feasible to avoid utilizing protoc in the build, have you considered the possibility of extending the buf image with protoc? It seems that we may just need to include a single package to that image, as discussed in this GitHub issue.

sandersms commented 10 months ago

Note that buf generate can't be run in a docker container due to protoc not being included.

Using the Docker image offers numerous advantages (consistent build env, pinned tool version etc.). In case it's not feasible to avoid utilizing protoc in the build, have you considered the possibility of extending the buf image with protoc? It seems that we may just need to include a single package to that image, as discussed in this GitHub issue.

Thanks for the different issue link - I had found some, but not one where it indicated the combined build. It seems that we would need to create a docker image that contains the needed additions similar to the sudorandom/buf-go or jetexe/gobuf in docker hub, or use this version which is 3 months old.

In trying both of the docker images in docker hub, both need the addition of protoc-gen-grpc-gateway in order to work correctly, so a new image is needed with protoc-gen-go, protoc-gen-go-grpc, and protoc-gen-grpc-gateway.

sandersms commented 10 months ago

Created a docker image of bufbuild/buf that contains the protoc files required to build all the target files and placed it in dockerhub for use. This allows generate to utilize docker builds for the files.