Skip to content

Commit

Permalink
docs: chore add publishing instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
YOU54F committed Aug 26, 2022
1 parent 80d7b13 commit c1da32a
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,54 @@ Like({

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

## Uploading pact files to a Pact Broker

There are two ways to publish your pact files, to a Pact Broker.

1. [Pact CLI tools](https://docs.pact.io/pact_broker/client_cli) **recommended**
2. Pact Python API

### CLI

See [Publishing and retrieving pacts](https://docs.pact.io/pact_broker/publishing_and_retrieving_pacts)

Example uploading to a Pact Broker

```
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
```

Example uploading to a Pactflow Broker

```
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
```

### Python API

```python
broker = Broker(broker_base_url="http://localhost")
broker.publish("TestConsumer",
"2.0.1",
branch='consumer-branch',
pact_dir='.')

output, logs = verifier.verify_pacts('./userserviceclient-userservice.json')

```

The parameters for this differ slightly in naming from their CLI equivalents:
| CLI | native Python |
|-----------------|-------------------------------------------------------------------------------------------------|
| `--branch` | `branch` |
| `--build-url` | `build_url` |
| `--auto-detect-version-properties` | `auto_detect_version_properties` |
| `--tag=TAG` | `consumer_tags` |
| `--tag-with-git-branch` | `tag_with_git_branch` |
| `PACT_DIRS_OR_FILES` | `pact_dir` |
| `--consumer-app-version` | `version` |
| `n/a` | `consumer_name` |

## Verifying Pacts Against a Service

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

0 comments on commit c1da32a

Please sign in to comment.