Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for branches in consumer version selectors #184

Closed
bethesque opened this issue Oct 13, 2021 · 1 comment
Closed

Add support for branches in consumer version selectors #184

bethesque opened this issue Oct 13, 2021 · 1 comment

Comments

@bethesque
Copy link
Member

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 (or main_branch for snake case languages) property consumer version selector (if there is a domain model for this).
  • Add a Boolean matchingBranch (or matching_branch for snake case languages) property consumer version selector (if there is a domain model for this).
  • Expose and document the branch, mainBranch (or main_branch for snake case languages) and matchingBranch (or matching_branch) properties in the user facing API.
  • Pass the branch, mainBranch and matchingBranch (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 to feat/x
    • You should receive the feat/x pact
@mefellows
Copy link
Member

Released in v1.6.6, will be released in next beta also.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants