CI/CD Setup Guide
Or "The steps for reaching Pact Nirvana"
This is a technical guide for developers and testers who want to use Pact to implement consumer driven contract testing as part of your ongoing CI/CD workflow.
By the end of the guide, you will understand how to create a release pipeline that allows you to independently deploy any application with the confidence that it will work correctly with the other applications in its environment - without having to run a suite of end to end tests.
This guide focuses on the scenario where the consumer and provider are both being deployed to an environment rather than released to customers (e.g. a mobile app). That workflow is slightly different, and that guidance will be coming soon.
For a complete hands-on workshop implementing the steps in this guide with GitHub, see: https://docs.pactflow.io/docs/workshops/ci-cd
How to use this document​
Each integration is different. Each organisation has different history and culture, and each team y have different processes for development, testing, and deployment. Each of these differences affect the best choices for Pact workflow.
However, there are many similarities in the steps necessary on the journey to a full-featured and effective Pact setup ("Pact Nirvana"). This document describes those steps.
Feel free to pick and choose the steps that apply best to your team. You may implement only the first few steps described below, and just use Pact as a precursor to your standard integration tests; or you may throw away your integration tests altogether and reach "Pact Nirvana".
This guide doesn't go into the details of how to write and run consumer tests or provider verification tests. Here we are laying out a high-level strategy for how you can get Pact set up and operational. Each of the levels below gets you a step towards having a fully automated process of verifying contracts as part of CI/CD with no need for an integration environment.
As Pact has been implemented in many different languages, this document will outline the theory for each step. You will need to consult the documentation of your chosen language to learn the relevant syntax for each task. See the implementation guides section for more information.
What are the steps for reaching Pact Nirvana?​
- Get Prepared - learn about pact
- Talk: get team alignment
- Bronze level: get a single test working manually
- Silver level: manually integrate with Pact Broker
- Gold level - integrate with your PR pipelines
- Platinum level: Add can-i-deploy with branch tag to PR pipelines
- Diamond level - Add Pact to your deploy pipelines
- Honors Course - To come in future...
- Add provider state
- Working with Feature Flags
Click below to expand and see each a diagram representing each level