You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We've been publishing our pacts from the consumer project by essentially sharing the file system with the provider. But this is not very manageable when you have multiple teams contributing to the code base, and pushing to CI. We can use a [Pact Broker](https://pactflow.io) to do this instead.
967
+
968
+
Using a broker simplifies the management of pacts and adds a number of useful features, including some safety enhancements for continuous delivery which we'll see shortly.
969
+
970
+
In this workshop we will be using the open source Pact broker.
971
+
972
+
### Running the Pact Broker with docker-compose
973
+
974
+
In the root directory, run:
975
+
976
+
```console
977
+
docker-compose up
978
+
```
979
+
980
+
### Publish contracts from consumer
981
+
982
+
First, in the consumer project we need to tell Pact about our broker.
Publishing 'FrontendApplication-ProductService.json' with tags step11, test, prod ... OK
1035
+
1036
+
BUILD SUCCESSFUL in 11s
1037
+
1038
+
```
1039
+
*NOTE*: For real projects, you should only publish pacts from CI builds
1040
+
1041
+
Have a browse around the broker on http://localhost:8000 (with username/password: `pact_workshop`/`pact_workshop`) and see your newly published contract!
1042
+
1043
+
### Verify contracts on Provider
1044
+
1045
+
All we need to do for the provider is update where it finds its pacts, from local URLs, to one from a broker.
1046
+
1047
+
In `provider/src/test/java/au/com/dius/pactworkshop/provider/ProductPactProviderTest.java`:
*NOTE*: For real projects, you should only publish verification results from CI builds
1104
+
1105
+
As part of this process, the results of the verification - the outcome (boolean) and the detailed information about the failures at the interaction level - are published to the Broker also.
1106
+
1107
+
This is one of the Broker's more powerful features. Referred to as [Verifications](https://docs.pact.io/pact_broker/advanced_topics/provider_verification_results), it allows providers to report back the status of a verification to the broker. You'll get a quick view of the status of each consumer and provider on a nice dashboard. But, it is much more important than this!
1108
+
1109
+
### Can I deploy?
1110
+
1111
+
With just a simple use of the `pact-broker`[can-i-deploy tool](https://docs.pact.io/pact_broker/advanced_topics/provider_verification_results) - the Broker will determine if a consumer or provider is safe to release to the specified environment.
1112
+
1113
+
You can run the `pact-broker can-i-deploy` checks as follows:
0 commit comments