Search code examples
pactpact-jvm

How to share pact file in bitbucket


I want to share the pact file from consumer to bitbucket and then provider can use from the same location.

Does anybody implemented this?

Thanks in advance.


Solution

  • It's worth noting that it's very much a non-standard way of doing it and I would highly recommend you don't do it this way (see https://docs.pact.io/pact_nirvana/step_4/). You're going to have to build a lot of the workflows again, and that will require investment in building tooling and coming up with ideas to evolve the contract. At some point, you'll be rebuilding key features the Pact Broker already has and would be better off just running that or using a hosted service like pactflow.io.

    So, without a pact broker, you don't get the can-i-deploy tool, versioning, environment management and all of these powerful workflows.

    With that said - if you do want to use bitbucket:

    1. you'll need to create a manual process (i.e. script) to upload (from consumer) and download (provider) from bitbucket
    2. You'll only want to upload from CI, so that's easier to control
    3. For provider verification, you really want to do this on a laptop, so you'll need a standard approach for pulling down the correct contract to verify there and on CI. Every team member will need credentials to read from that repo

    Pact doesn't have a mechanism to pull from git protocols, but you could potentially add that feature to the languages you need them for