-
-
Notifications
You must be signed in to change notification settings - Fork 176
How to ensure backwards compatibility by tagging pacts
bethesque edited this page Dec 9, 2014
·
6 revisions
If you want to ensure your provider is compatible with both the HEAD version of your consumer, and the PROD version, you can use pact tagging to enable the provider to verify itself against the PROD pact. To read more about this idea, check out this blog post on decoupling the release cycles of your services.
-
Determine the production version of your consumer. eg. "1.0.0".
-
Send a request to the Pact Broker's RESTful API to tag the given consumer version with the name of your choice. eg "prod"
$ curl -v -X PUT -H "Content-Type: application/json"
http://pact-broker/pacticipants/Zoo%20App/versions/1.0.0/tags/prod
- 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