is there any way to limit in time (like call it on...
# pactflow
f
is there any way to limit in time (like call it once for each 5m) the webhook call for a provider service We have a set of services that several consumer depend on, and some of those services are updated at the same time, thus triggering the call of the webhook at the same time.
m
We don’t have any constraints like that. Is it the same build running over and over? Or is it multiple different builds of the same provider at the same time? The webhook does have a de-duping mechanism built into it
f
well it's differnt consumers asking the same provider.
if ANY consumer needs contract verified for provider XYZ
problem is we have a solution that submits several consumer cotracts at the same time
m
Same provider version? What's the actual problem though, presumably they need to run to verify the different contracts that are changed? Are you running the full provider build each time, or just verifying the changed pact (recommended)?
f
yep
the provider didn't change
latest=true
m
The webhook fires because the consumer changes, not the provider. Each webhook that fires may send a different pact for verification. If the contract hasn’t changed, and the webhook still fires, it means the wrong provider version is verifying the contracts i.e. it shouldn’t always be the latest provider that verifies this build
f
yes, that i know
👍 1
m
all good, just checking 😛
f
it's just the same provider for several diferent consumers
m
if each webhook firing should be verifying different contracts, what’s the actual problem then?
f
because the provider when it runs, checks those all at the same time
m
so it shouldn’t do that, it should just verify the changed pact
at least, that’s our advice
f
in the webhook, it's there any way to give refer to the consumer who triggered it?
any property we can use
m
Copy code
${pactbroker.consumerName}
f
Copy code
{
  "definition": {
    "id": 4492
  },
  "sourceBranch": "main"
so i could add here
Copy code
{
  "definition": {
    "id": 4492
  },
  "sourceBranch": "main",
  "consumerPacticipant": ${pactbroker.consumerName}
}
like this and it would pass to this to pipeline, right?
👍 1
m
“sourceBranch”: “main”
what’s this ^^
f
azure pipeline
the trigger to launch the pipeline
this means use the main branch of github
for provider
m
Does that mean it checks out
main
branch?
✅ 1
So if you’re always checking out
main
, that’s a problem and will result in more webhook firings than you need, if you are using the recommended event. Some pacts need to be verified by different versions of the provider. Are you doing the following?
f
ok, i will pass this info and see what we can change
👍 1
this is kinda what we're using
m
Yep, so that is a good start. You need to also pass the
${pactbroker.pactUrl}
through to the build so it can verify the correct pact (and not just run the latest provider build). You should replace the hardcoded
main
with
${pactbroker.providerVersionBranch}
and
${pactbroker.providerVersionNumber}
to checkout the correct version of the provider
👀 1