pactflow / example-provider

An example of a provider that uses Pact+PactFlow to honour a consumer driven contract with its consumer
MIT License
19 stars 502 forks source link

Example Provider

Build Status

Can I deploy Status

pactflow-example-provider/pactflow-example-consumer

This is an example of a Node provider that uses Pact, PactFlow and Github Actions to ensure that it is compatible with the expectations its consumers have of it.

It is using a public tenant on PactFlow, which you can access here using the credentials dXfltyFMgNOFZAxr8io9wJ37iUpY42M/O5AIZWxelWbLvqMd8PkAVycBJh2Psyg1. The latest version of the Example PactFlow Consumer/Example PactFlow Provider pact is published here.

Pact verifications

When using Pact in a CI/CD pipeline, there are two reasons for a pact verification task to take place:

When the provider changes, the pact verification task runs as part the provider's normal build pipeline, generally after the unit tests, and before any deployment takes place. This pact verification task is configured to dynamically fetch all the relevant pacts for the specified provider from PactFlow, verify them, and publish the results back to PactFlow.

To ensure that a verification is also run whenever a pact changes, we create a webhook in PactFlow that triggers a provider build, and passes in the URL of the changed pact, to verify it against the head and deployed/released versions of the provider. Ideally, this would be a completely separate build from your normal provider pipeline, and it should just verify the changed pact.

Features

Usage

See the PactFlow CI/CD Workshop.