Skip to content

How to ensure backwards compatibility by tagging pacts

Amitoj Duggal edited this page Aug 8, 2018 · 6 revisions

If you want to ensure your provider is compatible with both the head version of your consumer, and the production version, you can use pact tagging to achieve this. To read more about this idea, check out this blog post on decoupling the release cycles of your services.

Step 1. Tag the production version of the pact

Step 2. Configure the provider to verify the production pact

  • Add a new pact URL to the verification configuration of your provider project. The new URL will be the same as the normal "latest" url, with the name of the tag appended. eg. http://pact-broker/pacts/provider/Animal%20Service/consumer/Zoo%20App/latest/prod

If you are using Ruby, the provider configuration will look like this.

Pact.service_provider 'Animal Service' do

  honours_pact_with "Zoo App" do
    pact_uri 'http://pact-broker/pacts/provider/Animal%20Service/consumer/Zoo%20App/latest'
  end

  honours_pact_with "Zoo App" do
    pact_uri 'http://pact-broker/pacts/provider/Animal%20Service/consumer/Zoo%20App/latest/prod'
  end

end