hi, we're trying to implement BDCT and are a bit c...
# pactflow
w
hi, we're trying to implement BDCT and are a bit confused how to publish the provider contract with the appropriate tags, branch and env. I followed this doc but the contract uploaded doesn't have any branch info and not sure how to pass it in. https://docs.pactflow.io/docs/bi-directional-contract-testing/contracts/oas#publishing-the-provider-contract--results-to-pactflow.
1
👋 1
y
Hi Wayne, Thanks for bringing this to my attention, (and apologies for the confusion) it was on my list of items to address as I had previously queried it. Hope the following is helpful. So I believe the current process is as follows, 1. create_branch_version (API Reference) / Example via Makefile / Example Script 2. publish_contracts (API Reference) / Example via Makefile / Example Script
branch version should be created before publishing provider contracts
3. Use pact-broker cli
pact-broker can-i-deploy
where environments are first used / example via makefile 4. Use pact-broker cli
pact-broker record-deployment
where environments can be recorded post deployment / example via makefile Notes:- 1. The current advice here https://docs.pactflow.io/docs/bi-directional-contract-testing/provider#step-5-deploy-your-application regarding tagging, is out-of-date and will be removed. 2. Both 1 and 2 in the steps above, will be available via the CLI soon. Roadmap item tracking CLI publishing tool is here will get the team to cast their eyes over cc: @Matt (pactflow.io / pact-js / pact-go) / @Beth (pactflow.io/Pact Broker/pact-ruby)
👍 2
m
That sounds right to me Yousaf. Apologies for the confusion Wayne, we’re in a migration between tags / branches and occasionally the advice is inconsistent
l
I’ve just arrived here and was going to ask the same question - thank you for updating the documentation. Our team spent some time with Pact and Pactflow last week as part of a hack week project and I think the “create branch version” step was missing at the time. I’ve updated our publish script and its now working. 👍
y
Wonderful, thanks for the feedback @Luke Redpath. Look forward to hearing how you get on, and the reception from the team after the hack week now it's working.
l
The reaction was positive, we still have lots of details to flesh out, mainly around how we produce OpenAPI specs for our existing APIs. We’re trying to document an plan for this now. We’re already starting to use PactSwift for our mobile client because even as a standalone mocking tool its providing our API client implementation with much better test coverage.
y
mainly around how we produce OpenAPI specs for our existing APIs
Yes, this is always a challenge, especially for legacy systems, that can be cumbersome to integrate with. I do have a couple of shortcuts, creating a postman collection to test an existing service, and generating an openAPI spec off the back of it. • https://github.com/joolfe/postman-to-openapihttps://github.com/kevinswiber/postman2openapi We use one of the above in https://github.com/pactflow/example-bi-directional-provider-postman I've been on the hunt recently for OSS tools around open api, and have a little cli tool that contains a selection of all the awesome things I've found, I thought it was a good way to bring my GitHub stars list to life, and for me to learn more about CLI tooling. I need to release it at some point 🙂
l
We do use Postman already but I think we’re hoping to migrate away because it needs to be manually maintained.
Most of our backend services are written in Elixir, we’ve already explored
open_api_spex
but are investigating the possibility of using our existing backend test suite to generate the open api docs.
We also have lots of microservices so taking it one step at a time…
y
wise choices all round there chap chefkiss