Hi, I wonder if I can publish the provider’s verif...
# pact-broker
l
Hi, I wonder if I can publish the provider’s verification results ‘manually’/curl to a self-hosted Broker 🤔 1- First I can run the verification and store the results as a JSON file, per example:
pact-provider-verifier #{_contract_json_file_} --provider #{_pacticipant_} --provider-base-url '<http://localhost:3000/>' -v --out #{_results_json_file_}
2- Then gather the verification results file and push it to the broker, per example:
curl -v -X PUT -H "Content-Type: application/json" -d @#{_results_json_file_} #{_broker_}/pacts/provider/#{_pacticipant_}/consumer/#{_service_consumer_}/version/#{_app_version_}/verification-results
Thanks a lot in advance for any advice you can provide me.
l
🙂 thanks! This is for PactFlow, is that to publish provider contract testing can only be done using PactFlow?
y
I know its for PactFlow but will work for your original question hence why I posted it
as in will work with an OSS Pact Broker
Essentially you are just acting at the pact provider verifier, performing a test and publishing a result
l
Ah! Ok, sorry for the miss-understanding! will try, thanks a lot
y
No worries my friend, good luck and be sure to let us know how you get on
👍 1
💯 1
m
I love that my answer was going to be “probably not” , and then you point at an example i wrote to prove me wrong 😆 You have the memory of an 🐘 and the resourcefulness of a gopher
😂 1
y
MattGPT has already answered all the questions - I just know where to find them 😂
😆 2
l
Thanks a lot! it works!
🎉 1
its alive!
😆 1
m
May I ask - why are you doing it this way?
l
Sure thing. The broker needs some authentication to be able to interact with-it, and the ‘easiest’ way is to use a cert. So at the end I need to interact with the Broker via http requests.
m
The broker needs some authentication to be able to interact with-it, and the ‘easiest’ way is to use a cert.
I’m assuming you mean certificate based auth / MASSL or something? (not simply TLS)
You could also potentially raise a feature request to support that authentication mode and/or submit a PR. That way you wouldn’t need to work around with APIs
(but it’s OK to do it I guess)
l
Sorry for the so long late answer facepalm , yes. This is for a MASSL. I will do this request, thanks for the idea!
👍 1
https://pact.canny.io/feature-requests/p/provide-massl-based-auth-support • Provide MASSL based auth support ◦ This is to add the support on adding a ‘cert’ and a ‘key’, regarding a self-hosted Broker that requires a ‘cert’ and a ‘key’. ◦ This will make the availability to call the ‘Pact::VerificationTask’ adding the ‘cert’ and ‘key’ to interact with the Self-Hosted Broker. ◦ As an example: --cert /path/to/client/cert.pem --key /path/to/client/key.pem
m
Thanks!
🙌 1
I doubt we’ll have time to pick this up any time soon, but if you’re really keen you could attempt a PR here: https://github.com/pact-foundation/pact_broker-client
👀 1
l
Hello there! Let me revive this quite old thread 😅 We’ve already worked in a solution that it is working for us: • broker client: https://github.com/pact-foundation/pact_broker-client/pull/142 • support: https://github.com/pact-foundation/pact-support/pull/99 • pact-ruby: https://github.com/pact-foundation/pact-ruby/pull/298 So we’ve tested this and works like a charm, so there are the PR’s to make this availability something possible for each PACT gem we’ve thought it is needed. Please, let me know if there is more info needed to be able to take a look to those PRs. Thanks a lot for your help!
👌 1
y
blobwave Fantastic thanks @Lluís Xavier Casals Garcia Thanks for all the various links as well. will tag Beth for review on those PR’s. We would probably want to document these capabilities in each of the repos, and then centrally possibly on the docs.pact.io (which pulls in the readme’s from the respective websites. Maybe a recipes page for MASSL based auth support https://docs.pact.io/recipes or possibly as an addendum to this page https://docs.pact.io/pact_broker/advanced_topics/using-tls or as a new section alongside
l
Great! thanks, will take a look.
m
Thanks for doing this, great stuff! I’ve added a couple of quick comments, but we’ll need the maintainer (Beth) to review etc.
We’ll get it on the radar today