Would there be an issue if we somehow published ve...
# pact-broker
r
Would there be an issue if we somehow published verification results of an earlier provider version later than the latest provider version? E.g. someone manually reran a failed CI/CD step in an earlier build and published the verification results along with it. Pact broker would treat this as "latest" even though it's not your latest software version.
m
I don’t think so, ordering is based on the creation date of the version: https://docs.pact.io/getting_started/versioning_in_the_pact_broker#version-ordering
Are you using
--latest
in your
can-i-deploy
checks? If so, you should stop that 😛
r
Ok thanks.
What about on the consumer side? Order is based on the creation date of the version resource - to clarify, that's whenever a pact gets published to pact broker right? I was thinking along the lines of verification using consumer version selectors. E.g. { "mainBranch": true } gives you latest version of consumer main branch. If consumers somehow published an earlier build later than the latest build, would it be a problem?
Nvm I just tested. When I use consumer version selector for { "mainBranch": true }, it verifies against all versions of the main branch, not just the latest.
m
I don't think that last statement is true
I think it would just verify the latest version for the main branch (otherwise each time you run the verification it could in theory, verify every consumer version ever marked as the main branch)
r
Ok, I checked the debug logs. It does indeed verify against the latest main branch of consumer. The verification is done for a pact content version that the consumer is using. So if verification is successful for that pact content version. All the other consumer versions that is using the same pact-version would be automatically verified is what I'm seeing in the matrix. Coming back to the question of if this could have an affect if we accidentally published an earlier consumer software version to pact broker at a later date than the latest consumer software version - I guess the worst that it can do is either failing the provider build if the provider no longer supports this earlier pact version, or later provider versions not verifying against the latest consumer software version. I guess it should be transparent enough to fix manually?
m
All the other consumer versions that is using the same pact-version would be automatically verified is what I’m seeing in the matrix.
correct, the pact contents is versioned independently of the application version. So if the contents are the same, any verification also applies to them
Coming back to the question of if this could have an affect if we accidentally published an earlier consumer software version to pact broker at a later date than the latest consumer software version - I guess the worst that it can do is either failing the provider build if the provider no longer supports this earlier pact version, or later provider versions not verifying against the latest consumer software version. I guess it should be transparent enough to fix manually? (edited)
Yeah I think so. If you re-run an old build of a consumer version where (for some reason) the provider hasn’t verified that before (i.e. triggers the
contract_requiring_verification_published
event) then it might fail a webhook build, but wouldn’t be the latest for the branch (so the main build wouldn’t fail. It wouldn’t fail
can-i-deploy
either if you’re deploying to an environment, because presumably it also isn’t in the target environment. The resolution in most cases anyway, is to simply re-run the build for the latest version.
👍 1