Hi All. Why does my provider's can-i-deploy step s...
# pactflow
m
Hi All. Why does my provider's can-i-deploy step say successful when the status of the broker is 'Unknown' awaiting the consumer contract to be generated and published to the broker? The provider side is uploading an openapi spec and newman verification results. In this scenario the consumer contract is invalid so should break my pipeline but its passing way before then. If I rerun this can i deploy step after the consumer has published and the status is failed in the broker, the can I deploy steps works as expected. Any ideas?
y
If you have no consumers, the provider would be free to deploy
If you’ve deployed the provider, and then the consumer contract comes along and it is wrong, it would be picked up during the can-i-deploy check on the consumer side, stopping it from being deployed and triggering a conversation as to where the error lies
as per the recommended setup you should be • uploading contracts with a branch • using a version number associated with or including a git sha • using the environment flag as suggested in the can-i-deploy check
m
Would the same thing happen if the consumer was published to the broker with version 1 and the provider publish was version 2? Would the provider still be free to deploy?
In my scenario I've deliberately made a breaking change to the provider (which causes issue with the consumer) at this instance it will go to production on the provider side and cause production issues for the consumer before any discussion can take place with the consumer side. What am I missing here?
y
you aren't using can-i-deploy correctly, you have not marked your provider as deployed to production and your screenshot shows no consumers
If your provider was marked as deployed to production, incompatible consumers would not be able to deploy to production. if your provider and consumer were compatible and both deployed to production, a breaking provider change against a deployed or released consumer would stop the provider deploying.
I would recommend going through the bi-directional workshop https://docs.pactflow.io/docs/workshops/bi-directional-contract-testing if you haven't already
m
Why does the provider side can i deploy work differently to the consumer? When I have no integration in the broker. I deploy my consumer pipeline which uploads the contract and calls the webhook to deploy the provider pipeline. The can-i-deploy step in the consumer pipeline waits as expected for the provider contract/openapi spec to be published and then verifies against it. All I have done above is the same scenario but starting from the provider pipeline and it acts differently
y
a consumer cannot deploy at all without a provider
a provider CAN deploy WITHOUT a consumer
until the consumer comes along, and then it is bound by its agreement, If the provider was already in production, the consumer must firstly honour the production provider.
A provider team has no job to do, in consumer driven contract testing, until a consumer pact has been published
1
bi-directional contract testing, allows a provider first aspect, whereby you may be designing your API via OpenAPI, and want Pact to protect you with can-i-deploy whilst you wait for consumers to come onboard
As you aren't publishing provider contracts with a branch, nor have them marked as deployed to an environment your can-i-deploy checks aren't deterministic (as they take the latest pact, rather than latest pact from a main branch - configurable, or the latest deployed/released)
m
Ok food for thought haha thanks a lot Yousaf
y
Any time buddy, that's what we are here for! I would try out the workshop and let us know how you get on, in your own time
m
I will take another look but I think with what you've described above I am very close to a working POC to move forward and demo to my team thanks
y
Awesome, good luck! Interested to hear your teams thoughts, and happy to work to iron out any reservations! I assume your based in the UK due to the timezone? I'm over in Leeds
b
To put it another way (in case it helps), the consumer-provider pairing is a direction dependency link. The consumer strictly depends on the provider (needs a compatible one to exist). The provider doesn't care if it has no consumers.
1
m
@Yousaf Nabi (pactflow.io) Yeah I am based in Manchester. Just demoed the bi directional stuff to our teams today actually haha. Think my line manager will most likely be in touch to arrange for you guys to do a talk in the near future if possible
y
Oh 👌 ! I used to live in Manc but hopped across the pennines now to Leeds. Sure thing, we've got some spot on solution engineers to help you guys out!