Hi folks, is the following behavior as designed? A...
# pact-broker
s
Hi folks, is the following behavior as designed? Assume we have a service X with version vX which has not yet been published to the pact broker. If I run
can-i-deploy
or
can-i-merge
for that version with
--retry-while-unknown
flag it behaves differently depending on whether the service is a consumer-only or if it has provider tests: • if the service has consumer tests only, the command will not retry and will exit immediately • if the service has provider tests (in my case it was provider tests only), it will retry as specified by flags
Seems like this is governed by whether there's
unknown
in the result returned by the broker. What's the logic behind the
unknown
field, like when is it populated?
m
I’d need to follow up with somebody who’s closer to the code, but the
--retry-while-unknown
is orthogonal to the application’s role, although in practice I think it means a verification result has not yet been populated for the target version to be deployed/merged. e.g. if you wanted to do
can-i-deploy -a X -v vX
then it would lookup
vX
in the broker, check for any related contracts and verification results associated with them. If there are any results not published, I think this would produce an
unknown
value for that, and wait. I think what you might be saying is that you’ve created version
vX
in the broker, but have yet to publish a contract associated with it and it’s not waiting?
s
I've checked that the version in question isn't present in the broker in either case. Can the broker make a decision based on a previously published versions or smth?
when I looked closely at the results, I noticed that in the case when it was waiting, the
provider
object under
matrix
had
name
set to
X
but
version
to
null
i think what might be happening is that there is a consumer pact published which calls out provider
X
as a dependency, but
vX
was never verified against that consumer pact. However in case of a service that's consumer-only, there is no contract in the broker that calls it a dependency, so it just exits?
m
Hmmmm no version in the broker, I'd expect the command to fail with a "not found" type error. Do you have any example output to review?
s
can-i-deploy-provider.json
apologies, this slipped through the cracks. Above is the response of
/can-i-deploy?pacticipant=cc-useless-service&version=non-existent&environment=stag
API call via HAL, this is a provider service (ie there are consumers present and deployed that depend on it)
If you run
can-i-deploy
cli for this, it will retry as specified via --retry flags
Here's the response for a different service, which is consumer only (there are no other consumers depending on it)
Copy code
{
  "summary": {
    "deployable": false,
    "reason": "No pacts or verifications have been published for version non-existent of cc-pointless-service",
    "success": 0,
    "failed": 0,
    "unknown": 0
  },
  "notices": [
    {
      "type": "error",
      "text": "No pacts or verifications have been published for version non-existent of cc-pointless-service"
    }
  ],
  "matrix": []
}