<@U9UUY3CU9> <@U5FCZAAUU> We were having a discuss...
# libpact_ffi-users
a
@Matt (pactflow.io / pact-js / pact-go) @uglyog We were having a discussion about publishing verification results when using non-broker sources on the pact-net channel. Someone had asked because the CI/CD guidelines recommend that a verification job be invoked with a changed pact URI (linked to the broker), which you then verify via a URL source (not a broker source) and publish the verification results back. The user was surprised that PactNet didn't support this option, but in the thread I explained that you can't publish verification results because you don't know the broker URL (and potentially credentials also). I raised an enhancement request and I've already pushed up a draft MR for it, but unfortunately at the moment it can't progress. I've checked the FFI and it doesn't support publishing verification results for anything other than broker sources: https://github.com/pact-foundation/pact-reference/blob/e32caf8defd399029dcdf09c5d9298a1fe71d75a/rust/pact_verifier/src/lib.rs#L1207-L1228 If I call
set_publish_options
on the FFI and add anything other than a broker source then it'll simply not publish anything and log an error instead.
So I think the only safe/robust thing to do if we want to support this (and given the CI/CD guide says it's the recommended way of doing it...) is that the user is forced to specify the broker URL in the publish options at the FFI boundary. We can design nicer library APIs on top of that, but fundamentally you can't just assume the host of the URI is also the host of the broker.
e.g. the broker could be running on a sub-path instead of a dedicated sub-domain, like
<https://ci.example.org/broker>
, so you can't just extract the host and reuse that. It'd also be very hacky to use some kind of fixed string in the path and take everything up to that path. Pact broker URLs always have
/pacts/
in them somewhere, but you can't just assume that's the only place that'll be. Again, someone could run their broker at
<https://ci.example.org/pacts>
and now string splitting is just asking for trouble.
b
I have answered on the issue.