Add support for branches in consumer version selectors
Opened this issue · 0 comments
bethesque commented
The Pact Broker now supports branches as first class entities. You can read more about this here: https://docs.pact.io/pact_broker/branches
Description
Please add support for specifying branch related properties in the consumer version selectors that are sent to the Pact Broker when requesting pacts to verify. Please do not do any verification of the consumer version selectors on the client side - the validation rules are subject to change. Just ensure that any error response is displayed to the user.
- For implementations that wrap the pact-ruby-standalone, update to the latest standalone version
- For implementations that use the rust implementation, update to the latest rust version.
- Add a String
branch
property to the consumer version selector (if there is a domain model for this). - Add a Boolean
mainBranch
(ormain_branch
for snake case languages) property consumer version selector (if there is a domain model for this). - Add a Boolean
matchingBranch
(ormatching_branch
for snake case languages) property consumer version selector (if there is a domain model for this). - Expose and document the
branch
,mainBranch
(ormain_branch
for snake case languages) andmatchingBranch
(ormatching_branch
) properties in the user facing API. - Pass the
branch
,mainBranch
andmatchingBranch
(must be camelcase) through to the relevant implementation (ruby and/or rust)
Verifying the changes
- Publish test pacts to the test broker
export PACT_BROKER_BASE_URL="https://test.pact.dius.com.au"
export PACT_BROKER_USERNAME="dXfltyFMgNOFZAxr8io9wJ37iUpY42M"
export PACT_BROKER_PASSWORD="O5AIZWxelWbLvqMd8PkAVycBJh2Psyg1"
docker run --rm \
-e PACT_BROKER_BASE_URL \
-e PACT_BROKER_USERNAME \
-e PACT_BROKER_PASSWORD \
pactfoundation/pact-cli:0.50.0.14 \
publish \
/pact/example/pacts \
--consumer-app-version fake-git-sha-for-demo-$(date +%s) \
--branch main
docker run --rm \
-e PACT_BROKER_BASE_URL \
-e PACT_BROKER_USERNAME \
-e PACT_BROKER_PASSWORD \
pactfoundation/pact-cli:0.50.0.14 \
publish \
/pact/example/pacts \
--consumer-app-version fake-git-sha-for-demo-$(date +%s) \
--branch feat/x
- Using your pact client library, verify
{ "mainBranch": true }
- You should receive the main pact
- Using your pact client library, verify
{ "branch": "feat/x" }
- You should receive the feat/x pact
- Using your pact client library, verify
{ "matchingBranch": true }
with the provider branch set tofeat/x
- You should receive the feat/x pact