Hello :wave: - we're working on implementing Pact ...
# pact-broker
e
Hello 👋 - we're working on implementing Pact for iOS and Android consumers. We've been discussing pact versioning and release deployment / recording relative to our branching strategy. I'm hoping this community can give us some feedback if we're approaching this the right way. 🌲 Branching: We use a trunk-based branching strategy. We have one
main
line of code from which we derive
feature/*
and
bug/*
branches. To work on stories, we use
feature/
branches and commit them back. The
feature/
branches are only committed back to
main
once the feature is complete. 🚚 Environments: While in development, the debug versions of the mobile apps can communicate with any environment - prod, prod-europe, prod-asia, staging, dev, localhost. 🔢 Question about versioning: • Since we have a number of engineers, it's conceivable that multiple engineers working on the same parts of the app could alter (thus version) a pact. Does it make sense for us to continue using the SHA for each version, rather than tying it to a version of the app itself (e.g.:
1.0.3-<sha>
)? 🛝 Questions about environments + deployment/release recording: • We understand the concept mentioned in the documentation about having multiple versions in production, possibly forever. Google Play and the App Store control the availability of the apps. To us it makes sense to
record-release
when we release a new app to the app stores. Is this best practice?
Deployments are a little more nuanced. As mentioned above, we have a number of branches going at any given time, so we're not as sure when to
record-deployment
. Any advice here is appreciated. • Since our mobile apps can point to any environment while in development, it seems like a given version is deployed simultaneously to each environment, in contrast to a service which makes its way sequentially through local -> dev -> staging -> prod. In that case, would it make sense to essentially record a new deployment with every push to a branch?
m
• Branching: ✅ • Environment: see below • Versioning: Either of those are fine really, the main point is that it’s deterministic and easy to connect a version in PactFlow to a version of code in your VCS. SHA is usually the easiest though • Deployments/releases ◦
record-release
is the usual practice for mobile applications pushing to the app store, yes ◦ I think you’ll really need to test that for yourself. I can see why you’d do it, but in theory I worry that it could place too much constraint on your provider as it needs to satisfy n versions of your mobile applications in that environment. But if you did, yes, a deployment would be the way to do it (rather than a release)
e
Thanks for the feedback! • Versioning: We'll stick with SHA for the time being. • Deployment/releases: We settled on releasing only in prod environments as a final post-build step when we ship the final release candidate to Google Play or the App Store. We are only deploying in non-prod environments once the code is merged back to
mainline
. The result (hopefully) is that providers only need to verify against only a limited number of deployments in the non-prod environments and the releases that are still supported in prod.
m
no worries
and the deployment caveat makes sense to me, that sounds reasonable
e
@Matt (pactflow.io / pact-js / pact-go), to follow up: Does mobile need to use
record-deployment
in our non-prod environments if our providers are using best practices to ask for the latest version of a pact? We understand that
record-release
is useful for when we deploy to production environments so providers can test against all the released versions.
m
@Matt (pactflow.io / pact-js / pact-go), to follow up: Does mobile need to use
record-deployment
in our non-prod environments if our providers are using best practices to ask for the latest version of a pact?
What do you mean by “latest version” of a pact here? Latest could be latest altogether or latest for a branch. Usually we discourage “latest” because it’s not clear
I think it’s good practice in general to record a deployment though, as it clarifies the state of the system
e
What do you mean by “latest version” of a pact here?
I'm using latest in the same way the broker docs describe it: ""latest pact" for an integration is available at the URL
/pacts/provider/{provider}/consumer/{consumer}/latest
, and refers to pact for the most recently created pacticipant version."
Usually we discourage “latest” because it’s not clear
Good to know. As mobile consumers, I am less familiar with the provider side of the equation. If Pact discourages use of "latest", does the provider specify a consumer version and keep changing it?
I think it’s good practice in general to record a deployment though, as it clarifies the state of the system
Heard. Our current setup has us recording a deployment from
mainline
whenever we merge feature, bug, or story branch back into it. In this way,
mainline
serves as our non-prod environment(s).