pact-foundation / pact-reference

Reference implementations for the pact specifications
https://pact.io
MIT License
91 stars 46 forks source link

Add Bazel to build libpact_ffi.a #255

Open opicaud opened 1 year ago

opicaud commented 1 year ago

Hello team :)

I am currently learning grpc and test it via pact in a monorepo context. To build this monorepo i am currently using Bazel, and so to be completly platform agnostic and being able to use pact libraries and binaries (libpact_ffi.a and pact_verifier_cli in this context) without any extra installation, i forked and "bazelify" pact-reference, and just what i need, in terms of scope.

This draft PR is just to open the discussion with you and inspect what i have already done

Olivier

rholshausen commented 1 year ago

Sorry, haven't had a chance to look into this in detail.

This adds a lot of Bazel specific files into the project that are not useful for anyone else. There are already CMake files in the pact_ffi directory, I'm wondering if it is better to have a separate external builds directory with these files in?

YOU54F commented 1 year ago

HI @opicaud

I had a brief look at Bazel when I was investigating gRPC in the various different language implementation.

Do you have an example of this in use, or could elaborate more on the use cases? Keen to hear about them even if they aren't useful to the masses

Thanks for getting involved in the source :)

opicaud commented 1 year ago

Hey @YOU54F,

To learn monorepos, i put in place some grpc microservices using pact to validate interactions. Also, to facilitate the monorepo building, i am using Bazel and so i "bazelify" protobuf-plugin and pact-reference to get a pact_verifier_cli and protobuf-plugin compiled from source --> Today, local consumer/provider testing is working well.

From Docker (and then from Kubernetes) i am trying to use the image you provide https://hub.docker.com/r/you54f/pact_verifier_cli, with the addition of protobuf-plugin from Bazel :) (still currently in dev)

See here:

Olivier

YOU54F commented 1 year ago

Hey @opicaud

How is it going?

I was thinking, it would be cool if you wanted to write up something about the experimentation you have been doing and we could feature it in one of our blog posts. I have an open source one due out this month but there is no rush, we can always write things in the future :)

If not, would love to hear how you've been getting on

opicaud commented 1 year ago

Hey @YOU54F

I am fine, the experimentation is very interesting :) What I learned and still learning is :

I am currently migrating to bazel 6.0 because they use a new way of dealing with dependencies and then i will need to realign my fork to your master to pull out few updates that you made guys :) and then continuing to provide an end-to-end flow (i do not have an cli for instance to "play" with the entire product) It's also very nice to participate to the community, i've participate to few others bazel-project by testing PR, providing feedback and red tests :)

With pleasure to participate to the blog and share this experiment even if everything is not perfect of course ^^ See you soon!

Olivier

YOU54F commented 12 months ago

This is great thanks, I've got a draft here https://github.com/pact-foundation/docs.pact.io/pull/269 will be going out on Friday, if you want to offer any edits feel free. Thanks again!

opicaud commented 12 months ago

Hey @YOU54F ,

i really like what you wrote, very big thanks for your support ☺️.

The first part is not entirely uptodate, but for the rest, again, thank you a lot. I will update on my side the documentation for more details.

FYI: i don’t use docker anymore and i won’t 😉 for two main reasons: i shift left pact-verification, during build process, before deployment, without docker, and being agnostic from platforms (linux and mac today, never tried on windows) thanks to bazel. I use now health checks in helm manifests to test that everything is well deployed. Helm charts linted via bazel rules during build process as well ^^. The second reason is that Docker was not a toolchain provided by now the deprecated ´rules_docker’, (rules provides their own toolchains) that’s why I migrate to ‘rules_oci’, agnostic from docker, and still keeping the possibility to test and push images, respecting the « open container initiative » format.

Olivier

YOU54F commented 12 months ago

Hey @YOU54F ,

i really like what you wrote, very big thanks for your support ☺️.

The first part is not entirely uptodate, but for the rest, again, thank you a lot. I will update on my side the documentation for more details.

FYI: i don’t use docker anymore and i won’t 😉 for two main reasons: i shift left pact-verification, during build process, before deployment, without docker, and being agnostic from platforms (linux and mac today, never tried on windows) thanks to bazel. I use now health checks in helm manifests to test that everything is well deployed. Helm charts linted via bazel rules during build process as well ^^. The second reason is that Docker was not a toolchain provided by now the deprecated ´rules_docker’, (rules provides their own toolchains) that’s why I migrate to ‘rules_oci’, agnostic from docker, and still keeping the possibility to test and push images, respecting the « open container initiative » format.

Olivier

Thanks for the update, especially with regards to Docker and OCI. I've recently been getting into type 1 hypervisors with Proxmox, and been playing around with building a mini cloud in a private homelab.

The blog page is open source, and you are welcome to edit the page if you wish?

opicaud commented 12 months ago

Hey @YOU54F Done, see 276