We are deploying our services for different region...
# pactflow
w
We are deploying our services for different regions. Sometimes it's only one but sometimes it may be 3 different regions. It may happen that the deployment for some regions will fail and then we may have different code (and by that also contract) version. We can handle registering different versions to different environments. I'm wondering if there is any feature which allows us to say something like 'can-i-deploy to any of production evnironment'? I mean any option of grouping environments or handling that in any other way? I know that I can hardcode multiple checks, but as I mentioned not all pacticipants deploy to all regions
m
hmm I can’t think of any constructs we have that would support that, aside from your suggestion of programming it on your side. Maybe if you could elaborate a little more on the use case and we can flesh out some ideas.
w
Let assume that we are providing some changes to our codebase which change the contract. We deploy that new code to eg. 2 regions US and EU US deployed correctly and EU failed - so at that point we need to choose one of 2 ways of handling contracts - have 2 separate envs which we are recording deployment to (in SB Portal) or have only one and we need to decide if we should record new version or not Assuming that we have 2 different envs, and we recorded for US and for EU previous record remain unchaged Now our pacticipant provides their change so we need to publish new contract and run can-i-deploy against the prod env. So we need to decide how to run this check. If we now for sure that each service is deploying to those 2 regions it's pretty easy. But in our case it can be one of those or even 3 different regions. So in that case we need to : • check in CI which regions is given service deploying to and then iterate through them • have some group of envs in pactflow so we can say 'hey check if this contract is valid for this service for any of production envs which it deploys to' and then this group is dispatching e.g. for US and EU I hope it will clarify a bit. It's not that easy to explain it simply
hi @Matt (pactflow.io / pact-js / pact-go), do you think there is any way to handle such a case?
r
Our system also has multi-region deploments. We record our deployment separately against these environments. In our pipelines we run the can-i-deploy check (as separate ci jobs) for each environment as part of merge request. Since that gives the can-i-deploy feedback as early as possible. In addition our deployment pipelines also run can-i-deploy on the target environment before actually deploying.
w
We probably would need to add those separate jobs or some kind of iteration through the envs. In general we have one PR cycle job which covers all the environments. To run can-i-deploy against each env we need to get the information about deployment regions for given service and then iterate (some services are deployed against one env, some against 2 and other to 3 regions)
m
Unfortunately I think at the moment the only option would be to do what @Ruud Welling is doing. Especially if the deployments aren’t atomic across envs - e.g. if it deployed to one but not the other, now you have a split view of what’s their if it’s a single environment. There is also the concept of “application instance”, which might be helpful for you: docs.pact.io/pact_broker/recording_deployments_and_releases#… (but in general, conceptually multiple-environments is probably easier to reason about)
thankyou 1