Hey there team We were setting up webhooks for se...
# pact-broker
f
Hey there team We were setting up webhooks for several teams, and when we started to see those hooks triggering the verification pipelines, we started to see a anormalous behaviour: https://outsystems.pactflow.io/settings/webhooks/d69Q-dhp6eCBtQ3z-oIvSQ/triggered-webhooks For example for one of our sevices
As you can see, it was triggering the same verification 4 times
and it isn't just 2 service, but several
can you check what's happening?
m
Same problem as last time. When a consumer publishes a pact and you use that event, it will trigger a verification for each provider version that covers the main branch, and any deployed environments. You need to checkout the different version on the CI environment to verify them. The provider for that consumer has been deployed to 4 environments, and has a main branch - hence the total of 5 triggered webhooks
Copy code
[2024-05-15T10:07:46Z] DEBUG: Webhook context {"base_url":"<https://outsystems.pactflow.io>","consumer_version_branch":"main","build_url":null,"consumer_version_tags":[],"event_name":"contract_requiring_verification_published","provider_version_number":"v1.315.416","provider_version_branch":"main","provider_version_descriptions":["deployed in dev","deployed in test"]}
Copy code
[2024-05-15T10:07:42Z] DEBUG: Webhook context {"base_url":"<https://outsystems.pactflow.io>","consumer_version_branch":"main","build_url":null,"consumer_version_tags":[],"event_name":"contract_requiring_verification_published","provider_version_number":"v1.315.411","provider_version_branch":"refs/heads/main","provider_version_descriptions":["deployed in stage"]}
Copy code
[2024-05-15T10:07:40Z] DEBUG: Webhook context {"base_url":"<https://outsystems.pactflow.io>","consumer_version_branch":"main","build_url":null,"consumer_version_tags":[],"event_name":"contract_requiring_verification_published","provider_version_number":"v1.315.401","provider_version_branch":"refs/heads/main","provider_version_descriptions":["deployed in ga"]}
Copy code
[2024-05-15T10:07:37Z] DEBUG: Webhook context {"base_url":"<https://outsystems.pactflow.io>","consumer_version_branch":"main","build_url":null,"consumer_version_tags":[],"event_name":"contract_requiring_verification_published","provider_version_number":"v1.315.406","provider_version_branch":"refs/heads/main","provider_version_descriptions":["deployed in osrd","deployed in osall","deployed in ea"]}
Copy code
[2024-05-15T10:07:33Z] DEBUG: Webhook context {"base_url":"<https://outsystems.pactflow.io>","consumer_version_branch":"main","build_url":null,"consumer_version_tags":[],"event_name":"contract_requiring_verification_published","provider_version_number":"v1.315.418","provider_version_branch":"main","provider_version_descriptions":["latest from main branch"]}
f
thanks for the reply, and sorry for the alarm
can you add this behavior to the documentation. Or, if it's already there, make it more visible. I think , imho, this is a important thing to be very clear. especially for companies with different tests environments (like ring architectures and so on). This makes that teams need to thing on how they tests things, the costs involved with 3,4,5 pipelines runs at the same time and so on
i wasn't aware of this for some time. It makes sense now that you clarified this to me, just that it changes things
m
No worries! I agree, it is confusing - the PactFlow UI is not making this any easier (there has been a bug in the pact broker which also exists in PactFlow that is not returning the Provider version in that table). I’m going to get that prioritised for fix in the next sprint or two.
can you add this behavior to the documentation. Or, if it’s already there, make it more visible.
Any thoughts on how you would reword this to make it clearer: https://docs.pact.io/pact_broker/webhooks#the-contract-requiring-verification-published-event
btw we do have our new UI in beta if you’d like to try it out. Give this a 👍 if you are interested, and I can hook you up
👍 1
f
well it's well written, just we need maybe to add a notice box, and give a concrete example
you can kinda give our case as an example
service is deployed in 3+ environments
and dev and test have same version
Copy code
This event is supported from version 2.82.0 of the Pact Broker. It is a much smarter implementation of the contract_content_changed event, designed specifically for the recommended Pact webhook workflow. It triggers once for each of the following provider versions that are missing a verification result for the newly published pact:

the latest version from the provider's main branch
any version currently deployed to an environment
The provider versions are de-duplicated by version number, so that if the same provider version is the head, and/or deployed to multiple environments, the webhook will only trigger once for each provider version. The template parameter ${pactbroker.providerVersionDescriptions} will contain a description of which branch/stages that particular provider version number pertains to. eg. "latest from main branch, deployed in test"

-->
/info 
Please then take notice that because of this several pipeline calls *will* be made to the provider service. For example in a provider service that is deployed in 3 environments (let's say dev, test, prod) and the same version of service is in 2 of them (dev and test for example) it will trigger 3 times. One for main branch, 1 for the version that is in dev/test and another for prod.
So, is our advice to use our template parameters to properly check against the necessary versions, have your test setup able to accommodate testing different versions and the necessary test execution setup and agents to run several pipelines at the same time

/info

<--
something like what i wrote