Greg Tyler
02/04/2022, 9:26 AMmain
(to ensure no regressions are being introduced)
• Test results are published to Pact Broker
• This triggers a webhook because provider_verification_published
was fired
◦ The webhook is to set a “Pact verification” commit status check on GitHub
• Because we’re checking against main
, this updates the status of the HEAD commit
Ultimately this means that my “Pact verification” status check on the main/HEAD commit reflects the last provider PR rather than the actual PR status.
I have a few solution ideas:
1. Am I missing a webhook setting to only trigger when the provider build was tagged main
? That way I’d stop pushing commit statuses for PRs.
2. Should I not publish Pact results from PRs to the Broker? That would ensure it didn’t trigger the webhook, but would limit the amount of useful information in the Broker
3. Should I include the provider version in the GitHub commit status context? (e.g. so I have “Pact verification against main”, “Pact verification against {PR name}“) This will mean I have extra checks, potentially including failures from irrelevant provider PRs
I’m erring towards the second option, but I think this is a slightly philosophical “how to use Pact” question so would be interested to hear what other users and maintainers think.Akke Luukkonen
02/04/2022, 10:18 AMprod
or develop
environments, so I feel I'm not losing any value by skipping the publishing for PRs.
There was a PACT_BROKER_PUBLISH_VERIFICATION_RESULTS
env variable that is already checked whether the run should publish a result or not, so I'm using that to skip the result publishing in my CI.
Azure Pipelines:
variables:
publishPactResults: $[lower(ne(variables['Build.Reason'], 'PullRequest'))]
...
- task: Bash@3
displayName: Run verification
...
env:
PACT_BROKER_PUBLISH_VERIFICATION_RESULTS: $(publishPactResults)
Greg Tyler
02/04/2022, 11:04 AMAkke Luukkonen
02/04/2022, 11:28 AMcontract_requiring_verification_published
option that doesn't trigger the webhooks on each publish, but it does require some additional setup (docs). It has worked great for me to reduce the amount of test runs executed "unnecessarily".Greg Tyler
02/04/2022, 11:31 AM