Skip to content

Commit c1da32a

Browse files
committed
docs: chore add publishing instructions
1 parent 80d7b13 commit c1da32a

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

README.md

+48
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,54 @@ Like({
290290

291291
For more information see [Matching](https://docs.pact.io/getting_started/matching)
292292

293+
## Uploading pact files to a Pact Broker
294+
295+
There are two ways to publish your pact files, to a Pact Broker.
296+
297+
1. [Pact CLI tools](https://docs.pact.io/pact_broker/client_cli) **recommended**
298+
2. Pact Python API
299+
300+
### CLI
301+
302+
See [Publishing and retrieving pacts](https://docs.pact.io/pact_broker/publishing_and_retrieving_pacts)
303+
304+
Example uploading to a Pact Broker
305+
306+
```
307+
pact-broker publish /path/to/pacts/consumer-provider.json --consumer-app-version 1.0.0 --branch main --broker-base-url https://test.pactflow.io --broker-username someUsername --broker-password somePassword
308+
```
309+
310+
Example uploading to a Pactflow Broker
311+
312+
```
313+
pact-broker publish /path/to/pacts/consumer-provider.json --consumer-app-version 1.0.0 --branch main --broker-base-url https://test.pactflow.io --broker-token SomeToken
314+
```
315+
316+
### Python API
317+
318+
```python
319+
broker = Broker(broker_base_url="http://localhost")
320+
broker.publish("TestConsumer",
321+
"2.0.1",
322+
branch='consumer-branch',
323+
pact_dir='.')
324+
325+
output, logs = verifier.verify_pacts('./userserviceclient-userservice.json')
326+
327+
```
328+
329+
The parameters for this differ slightly in naming from their CLI equivalents:
330+
| CLI | native Python |
331+
|-----------------|-------------------------------------------------------------------------------------------------|
332+
| `--branch` | `branch` |
333+
| `--build-url` | `build_url` |
334+
| `--auto-detect-version-properties` | `auto_detect_version_properties` |
335+
| `--tag=TAG` | `consumer_tags` |
336+
| `--tag-with-git-branch` | `tag_with_git_branch` |
337+
| `PACT_DIRS_OR_FILES` | `pact_dir` |
338+
| `--consumer-app-version` | `version` |
339+
| `n/a` | `consumer_name` |
340+
293341
## Verifying Pacts Against a Service
294342

295343
In addition to writing Pacts for Python consumers, you can also verify those Pacts

0 commit comments

Comments
 (0)