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 #89

Closed
bethesque opened this issue Oct 13, 2021 · 4 comments
Closed

Add support for branches in consumer version selectors #89

bethesque opened this issue Oct 13, 2021 · 4 comments
Labels
enhancement New feature or request verification

Comments

@bethesque
Copy link

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
@jbwheatley jbwheatley added enhancement New feature or request verification labels Oct 14, 2021
@jbwheatley
Copy link
Owner

added, but needs testing

@jbwheatley
Copy link
Owner

@bethesque is there a reason you'd like these added as fields to the ConsumerVersionSelector model, but the others here #68 such as deployed and released aren't recommended to be strongly typed?

@jbwheatley
Copy link
Owner

added in v0.2.0

@bethesque
Copy link
Author

@jbwheatley I'm so sorry I never replied. This got lost in my never ending list of email alerts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request verification
Projects
None yet
Development

No branches or pull requests

2 participants