Hi everyone, what guidance can you give about usin...
# general
c
Hi everyone, what guidance can you give about using
can-i-merge
with monorepos, where that monorepo contains consumers and providers, and each consumer & provider has its own build pipeline? Our usual pattern is for work to be done on both ends out of the one branch. The problem comes when we run
can-i-merge
on the the answer is always no because the provider work (part of the same branch) is not yet merged to the main branch.
👀 1
m
Not sure of the best answer, but we perhaps could update our docs as we’re seeing more questions on monorepos these days
The problem comes when we run
can-i-merge
on the the…
I assume you meant “the consumer”? If so, do you really need to use the
can-i-merge
check? That seems less relevant, given the code is always in the same branch.
can-i-merge
is a relatively new command, one of the use cases it was created for was PactFlow’s BDCT feature
c
yes, I meant consumer, coffee hadn't kicked in by the time I posted the message
😆 1
If there was a way I could give it a list of additional branches to check (in addition to the "main branch") it would probably work? Or is there an alternate command I can use?
y
hmm is the consumer and provider deployed anywhere on the pr? maybe an ephemeral env? you could maybe create an env for the pr run verification with consumer version selectors against matching branch and triggers by webhook or whatever when the consumer pact is changed. record deployment of provider run consumer can i deploy to the pr env? just sound boarding here
c
> consumer and provider deployed anywhere on the pr? No, deployment happens after merge. > create an env for the pr...run consumer can i deploy to the pr env? That could work, but it appears the pact broker should already know that the branch is compatible with itself and I'd like to avoid adding extra complexity (pact envs). We have the
contract-requiring-verification-published
broker webhook setup and run can-i-merge with the
retry-while-unknown
flags. Is there an endpoint on the broker I can call/curl to get compatibility results for a consumer & producer pair for a particular version or branch? (apologies if you've already documented this). If this exists then I could alternatively check that the PR works against main or that the PR works against itself.
@Yousaf Nabi (pactflow.io) / @Matt (pactflow.io / pact-js / pact-go) do either of you have examples showing how to get verification results from the pact broker via curl?
While I'm on the topic, how do I discover the
pact_version_sha
required for calls to this? https://github.com/pact-foundation/pact_broker/blob/master/lib/pact_broker/api.rb#L48C1-L49C1
y
re the first question, you can follow the HAL links
Copy code
curl <http://localhost:9292/pacts/provider/Example%20API> | jq '._links|."pb:pacts"
curl <http://localhost:9292/pacts/provider/Example%20API/consumer/Example%20App/version/5556b8149bf8bac76bc30f50a8a2dd4c22c85f30> | jq '._links|."pb:latest-verification-results"'
curl <http://localhost:9292/pacts/provider/Example%20API/consumer/Example%20App/pact-version/cc79bbc141aa53a4fd45d155d705cbb243dec4b6/verification-results/latest> | jq .
actually this answers the 2nd q, you just do it following the hal relations, which mean the client doesn’t need to be aware of url paths that may change and the version identifiers contained within them
c
thanks