Ben Brugman
03/04/2024, 3:17 PMpact-broker \
can-i-deploy \
--pacticipant=IOSConsumer \
--latest
--pacticipant=AndroidConsumer \
--latest
--broker-base-url=<https://pact-broker.com/feature> \
--to-environment=PROD
But it feels like a lot of maintenance to always have all your pacticipants up to date.
So in short, which answer applies most
1. We are mis-using Can-I-Deploy.
2. We are doing it right and should take care of managing all the pacticipants on multiple brokers.
3. We Should run all pacticipants of one broker at once, and we missed some pact functionalityMatt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
pact-broker \
can-i-deploy \
--pacticipant=IOSConsumer \
--latest
--pacticipant=AndroidConsumer \
--latest
--broker-base-url=https://pact-broker.com/feature \
--to-environment=PRODyou should never use the
--latest really, because that makes things non-deterministic (how do you know “latest” is the thing you want to deploy? Maybe the latest thing published was some branch for a WIP thing which passes, but not the latest for main branch which just happened to be published a few minutes before).Matt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
The plan is to make sure all contracts are verified when we want to do a merge.You seem to be implying you merge all of the applications (and therefore, contracts) at the same time? If not, you should only consider the application you are merging with
can-i-deploy (or can-i-merge if you want to use that).
The reason we think that is because Can-I-Deploy seems to only work for 1 single pacticipant at the time, we know you can give multiple pacticipants like this.that’s not true. It can take multiple, but for the reasons you d escribe most people don’t use it that way. You give it the thing you want to deploy, and it checks in the target environment all dependencies will continue to work
Ben Brugman
03/05/2024, 6:05 AMMatt (pactflow.io / pact-js / pact-go)
pact-broker record-release. Each one of these are now considered “in production”. When any dependency of that changes (e.g. the provider) and wants to release, when it calls can-i-deploy it will check all released versions of the mobile app.
i.e. can-i-deploy figures out what’s in the target environment, and if the app being deployed into it will be compatibleMatt (pactflow.io / pact-js / pact-go)
That is why i was saying it feels like we are not using can-i-deploy correctly. because now we require a script to ensure we have a list of all our pacts in all our broker so we can use can-i-deploy for all of them, instead of saying check all for this broker.yes, definitely you don’t need to do anything like this, unless you have some strange setup. It sounds like a typical mobile use case to me
Matt (pactflow.io / pact-js / pact-go)
pact-broker record-support-ended (see https://docs.pact.io/pact_broker/recording_deployments_and_releases#recording-support-ended-for-a-release)Ben Brugman
03/05/2024, 8:30 AMMatt (pactflow.io / pact-js / pact-go)
okay, but then in my mind, my challenge shifts from testing all pacts, to finding out which pacts changed and put those through can-i-deploy. because one app will have multiple pacts and it’s pacticipants. is that correctI don’t understand why you need to work out which pacts changed? If you’re deploying Application A, simply ask
can-i-deploy if you can deploy it. Whether or not the contracts have changed is orthogonal to that problem. It will say “OK, you want to deploy A into prod, let me go and look at all of the dependencies of that in prod and check that you won’t break them and/or they won’t break you” (plus all released versions, in the case of mobile app and the provider is the one asking the question)Ben Brugman
03/05/2024, 2:05 PMcan-i-deploy from the consumer side (the mobile apps).
When you say Deploying application A, this means multiple pacts associated to that application right?
Therefor the assumption remains that you need to run can-i-deploy for all your separate pacts that you have. How else do you make certain all is well?Ben Brugman
03/06/2024, 9:18 AMCan-I-Deploy , not the consumer pacticipants.
now indeed it will pick up all the pacticipants and it's versionsBoris
03/06/2024, 10:10 AMcan-i-deploy (or can-i-release) for you deploy/release either side. You should do both, really.Boris
03/06/2024, 10:12 AMBoris
03/06/2024, 10:15 AMMatt (pactflow.io / pact-js / pact-go)
We should use the provider pacticipants when we doyes! or rather, in the consumer build pipeline you add the consumer app that you are deploying. In the provider build pipeline you add the provider app that you are deploying. in general - you specify the pacticipant you are deploying in can I deploy. Think of saying it in English to your team mate “That work on ApplicationX is done, can I deploy it to production?” That’s effectively what can-i-deploy is for, not the consumer pacticipants.Can-I-Deploy
Ben Brugman
03/07/2024, 9:28 AMMatt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
record-support-ended when you deprecate a mobile version.