Hi folks! I recently switched across to the new ru...
# general
g
Hi folks! I recently switched across to the new rust verifier, which is generally providing much better output that the old ruby one (aside from the verification results in Pact Broker being a bit limited IMO). I’m also finding the pending/WIP pacts functionality much better, but I’ve got a query about that: How do we stop checking pending pacts when they’re outdated? e.g. I create a consumer branch
cool-new-feature
. The provider verification checks it as a pending pact and finds it absolutely cannot comply. So, sadly, I close my branch. But the provider doesn’t know this, and on each build keeps trying to check if it can now match `cool-new-feature`’s interactions. Can/should I tell Pact broker that the branch has closed and the pact doesn’t need verifying? Should I be doing
--include-wip-pacts-since={TODAY}
so it only looks at the most recently updated stuff? Am I completely misusing pending/WIP pacts?
y
Hey dude, I'd clean up the pacts from that branch from the broker, so they don't exist.
assuming you are closing the branch and not planning on reopening it. (do you close and delete in this situ, or just close) if you did reopen, you would anticipate a CI run proceeds again which would publish a pact which is again incompat
g
Yeah, we close and delete branch. Is there a documented way to do that? I’m imagining I need a GitHub Action that runs on branch/PR close (not merge) and sends an HTTP DELETE to the broker targeting all pacts tagged with that branch name?
t
On the one hand, sure, that seems reasonable. On the other hand, why does it matter if you’re verifying irrelevant pacts? It shouldn’t fail your build
g
It just takes up time in the build. It takes about a minute per pact, so if that keeps growing with every experimental PR then our release pipeline is quickly going to get very slow
m
Is there a documented way to do that? I’m imagining I need a GitHub Action that runs on branch/PR close (not merge) and sends an HTTP DELETE to the broker targeting all pacts tagged with that branch name?
we would love to build an SCM integration for exactly this purpose - purge/delete dead branches based on closed PRs, deleted branches etc.
But yes, something like this is doable
This API route is what you want - https://github.com/pact-foundation/pact_broker/blob/master/lib/pact_broker/api.rb#LL36C126-L36C126 https://github.com/pact-foundation/pact_broker/blob/master/lib/pact_broker/api/resources/pact_versions_for_branch.rb TL;DR - issue a DELETE request to
/pacts/provider/provider_name/consumer/:consumer_name/branch/:branch_name
But you should probably navigate to it using the HAL relations