Hello :wave: Sorry if this has already been asked....
# general
m
Hello 👋 Sorry if this has already been asked. I've just got a question around verifying contracts by provider that were published by branches on the consumer so get tagged with the branch name. We have found that we're having to update our provider verification code (consumerVersionTags) each time to reference the branch where the contract that was published from. I've read this page in the pact documentation and it suggests using the using the git branch name in ConsumerVersionSelectors and ensure the git branch for both the provider and the consumer are the same when the contract gets published and verified. We have tried this and it appears to work but means we'd need to remember to do this every time going forward. This document also mentions dynamically determining the tags of the feature branch which sounds like a much better option. Has anyone done this and got some examples or other suggestions?
m
The CI/CD workshop (howtolearn) shows how to address this
👀 1
s
Here are a number of useful hands-on labs that teach all of the key concepts: https://docs.pactflow.io/docs/workshops and https://docs.pact.io/implementation_guides/workshops
m
☝️
m
Thanks for the links Matt but is there anything more specific that covers verifying contracts on branches?
m
are you using “tags” or “branches” and “releases”?
There are two main ways: 1. webhooks - whenever a consumer publishes a new pact (from any branch) you can trigger a build to verify it: https://docs.pact.io/pact_nirvana/step_5#d-configure-pact-to-be-verified-when-provider-changes 2. pending pacts - https://docs.pact.io/pact_broker/advanced_topics/pending_pacts
m
We have been using tags but have recently read about branches, we're already using the webhook to trigger the verification but unless we change the consumer tag on the provider to point to the branch it never verifies the contract published from branch
Thanks I'll have a read of pending pacts