Hi, I recently read that it is advised to change ...
# pact-broker
w
Hi, I recently read that it is advised to change from tags to branches & deployed/released. Regarding Pact Nirvana I wonder what impact it has. I assume we now use the branch to publish pacts or validations on feature branches and mark the environment with the record-feature after successful deployment. Does it still hold true that we publish pacts only on PR validation and once they passed the verification and can-i-deploy (to environments) check we merge and instead of tagging main we set the stable branch (e.g. main) on the pact that was published during PR build?
y
Correct, depending on your PR merge setup, you may publish pacts from the main branch build as well, that would have a new version number but the same content, and would be pre-verified from the PR branch. (assuming the provider has verified the changed content pact on the feature branch, by way of webhook, or using WIP progress pacts on the providers regular CI build) Once is it deployed into an environment, you would record that version as deployed to x environment.
w
Hey Yousaf, thanks a lot 👍 - that answers a second question I had as well. One followup regarding the "pending-pact"-feature. I read that it is used in conjunction with tags. Is there a way to use it with maven JVM-plugin and branches? A colleague of mine pointed out an example where a change in a Consumer contract e.g. name of interaction state would cause the provider to need to change it and this would be a backwards incompatible change. We figured from reading the docs that a pending pact might help us here - however we are unsure on how to use it without tags.
y
pending pacts should work with branches without anything, bar adding enable pending into your provider lang. let me find some doccos
I've got some pending updates which should provide more clairity https://github.com/pact-foundation/docs.pact.io/pull/178 which updates the pending pacts essentially replacing tags with branches. (tags were used as psuedo branches before) https://deploy-preview-178--docs-pact-io.netlify.app/pact_broker/advanced_topics/pending_pacts
Have been waiting for reviews from the team before putting these live,
name of interaction state would cause the provider to need to change it and this would be a backwards incompatible change
changing interaction state yeah will cause issues on provider side if they are looking for that, we could do better at being able to make those states more visible to both parties, so its easier to sync up or grok for providers with multiple consumers. Not sure of the right solution there but think it is a problem
w
Much appreciated Yousaf 🙂 Thanks a lot! Guess you are making my day today!
🙌 1
y
Awww well if you can test it out and be my guinea pig, it would be much appreciated
👍 1
w
Hey Yousaf,
yo 1
we are having a look at pending pacts and I wonder: Pact-Nirvana states that during PR-validation we would verify against the stable branch of the Consumer and also check with the can-i-deploy whether we are still compatible to production as versions between stable branch and production might drift with time. My question to the pending pacts: Do we still need the can-i-deploy step or is this actually incorporated in the verification when using pending pact as suggested in your documentation where we use the selectors mainBranch: true and isDeployedOrReleased: true? Right now I would assume if we run the can-i-deploy still it would fail.
y
the selectors pick pacts to verify and the provider build publishes results. you still want the can-i-deploy check to check the application, and specifically the application version, is compatible to be deployed into an environment, which will query the results performed by the provider verification
w
Ok, then I got it wrong. Thanks for clarification 🙂
y
I think I am following though, if a provider was to deploy that version of code, directly after doing a provider verification on their main build, they have verified all their pacts, the verification task will only fail if the provider made a regression (as enable pending is on) as there is a usually a delay even small in deploying services after running the verification build, we always advise running can-i-deploy directly before your deploy task, and record-deployment after. These might be different pipelines so best advising always use can-i-deploy 🙂
w
Hey Yousaf, sorry for bothering again. The following scenario: Consumer is changing an already existing PACT and changes the "given"-scenario on a feature branch. This would trigger provider verification on its stable version (we do not use web hooks) against the feature/branch and verification would fail. Now we look at the provider - in order to comply with the change a feature branch would be opened and the state would be renamed according to consumer requirements. This would mean we have a change that is no longer backwards compatible with consumer versions being on the stable branch e.g. master or the deployed version in production, but only the one on the feature branch of said consumer. In our case we would have a valid verification for both versions consumer and provider that are deployed in prod, we would have a failed verification of the feature branch of the consumer and the stable branch of the provider and we would have a successful verification of the feature of the consumer and the provider. Now this is where my question from earlier comes in: In the PR of the provider we would besides the verification also check whether we can deploy to production. In our case however, we do not have an entry in the matrix that would successfully verify production version of consumer to the new changed provider as the contract of production version and the verification (state was renamed) are no longer compatible and the PR would be blocked. Likewise the consumer can not merge his PR as the provider can not go ahead. From my understanding the pending-pact feature would allow to have the verification exit with a status code 0 and not fail the PR, however the can-i-deploy check would still block it? Now I wonder, did I get something wrong with pending pacts, is this scenario likely and are there ways around it?
Regarding your documentation that you linked earlier - we played the guinea pig and we were able to introduce a pending pact that would not break the verification step of the provider of our pipeline (exit code 0), but mark the run as failed in the pact broker.