Search code examples
testingpact

Plugging Pact into CI / CD


I would like to as some basic questions concerning plugging Pact into CI / CD workflow: - I understand that pact publication / verification should be done in the CI step, then during CD we check whether it is possible to deploy a service using existing data from compatibility matrix (can-i-deploy) ? - In my project, the CD environments for non-PROD and PROD are completely separated, so do I need to have two separate Pact Broker instances and somehow synchronize them ? We could check compatibility only during non-PROD deployment, but PROD can contain different versions of applications which are possibly not compatible with the one deployed


Solution

  • If it is possible to share a single Pact Broker instance between the two environments, that would be the ideal solution. You should tag each application version with the relevant stage when you deploy to it (eg.test, prod) and use these tags when you perform the can-i-deploy check, passing in the relevant stage. The can-i-deploy logic relies on the history that you build up in a single broker. You could potentially sync between two brokers, but it would be quite fiddly. I'd only explore this option once you have ruled out the possibility of using one.

    I recommend reading the Effective Pact setup guide if you haven't already. Ping me on the pact-broker channel if you get stuck.