Is there a way to make can-i-deploy checks trigger...
# pact-broker
n
Is there a way to make can-i-deploy checks trigger verification runs if there is no verification result when the can-i-deploy check occurs?
y
no, you would use webhooks for that purpose, you can set can-i-deploy to retry and poll however,
Copy code
--retry-while-unknown 6 --retry-interval 10
which gives time for the triggered verification run to have taken place
n
webhooks
I already use the
contract_requiring_verification_published
webhook, however we occasionally have a race condition where a new consumer version will be deployed while a provider is going through the pipeline, so the end result is when the provider hits its deploy, the deploy fails because the two versions never lined up. Are there distinct error codes for outright failure vs no verification result that could be keyed into to trigger a verification?
m
can-i-deploy
should run immediately before a deployment - are you saying a race condition is happening there? If there is a big gap between
can-i-deploy
and
deploy
that’s probably worth addressing first
n
can-i-deploy
is happening immediately before deploy in the pipeline. The race condition I’m describing is with verification. e.g.: Consumer X v1 and Provider Y v1 are currently deployed. Commits are made to both and the pipelines are running concurrently. Provider Y v2 runs verification against Consumer X v1 in its pre-deploy pipeline, Consumer X publishes its Pact for v2, which triggers a verification webhook against Provider Y v1, which is the currently deployed version. That verification passes, and Consumer X v2 passes the can-I-deploy check and is deployed. Now Provider Y runs a can-i-deploy check for v2 which fails because Consumer X v2 is now deployed, and has not been verified against Provider Y v2, due to v1 being the deployed version at the time the consumer pipeline triggered the verification webhook, and Consumer X v1 being the deployed version when the provider pipeline ran its own verification.
Diagram to aid understanding…