:blobwave: How can I adjust in my `Provider Servic...
# pactflow
a
blobwave How can I adjust in my
Provider Service
's gitlab job, or pactVerify selectors (or other alternatives?), to run the pactVerify for all the past consumer versions (released) and publish results.... but allow it to fail on the released.... PLUS ONLY really prevent my MR to be merged (ie: not allowed to fail) if and only if the `pactVerify`failed for `latest_from_main_branch`or deployed. (but ignore if it failed a past released version of the consumer) CONTEXT I have this scenario • a
Consumer Service
publishing a pact when it's merged to it's main branch, and this pact is ready in my pact broker to be verified with
Provider Service
• then I have the
Provider Service
gitlab pipeline, to verify against that pact from
Consumer Service
with selectors
latest_from_main_branch
+
released_or_deloyed
• Also, I am marking each and all versions of the consumer as released (and only one as deployed) If my
Provider Service
's
pactVerify
finds 10 released versions (with of them been the latest + deployed) it would run 10 times it's verification and publish those 10 results... (I am still trying to test if the
pactVerify
fails only 1/10 (eg the very first version of the consumer) would the total result be
PASSED
or
FAILED )
✅ 1
y
you only need to record a deployment or a release. not both. a deployment, removes existing records to deployed contracts, and replaces with the version now deployed a release, will mark that version as active, and all other versions remain active. do you actually multiple versions of your consumer deployed at one time?
a
yes, you are right and I understand the difference between both (release or deployed) but my question remains the same: I want my
pactVerify
task to run against all the consumer's released versions (and publish the results so they are available later on for me to use
can I deploy
but my provider's pipeline ONLY to prevent to be merged if only the latest fails (but not to prevent the merge if an old version of the consumer failed)
(thanks for the quick response btw)
... I guess my question boils down to what I am still trying to test: if the
pactVerify
from the provider's gitlab's pipeline fails 1/10 released consumer versions (eg the very first version of the consumer, but passes all the other 9 ones, including the latest) ... would the total result be
PASSED
or
FAILED
❓ thinking
I think my best option is to simply run pactVerify against all release consumer versions... and on my open MR's pipeline allow this task to fail (so the purpose is only to publish the results of ALL verifications) and then on a further step, run a
can I merge
which only checks against the latest version, which would fail only if the verification against the latest consumer fails, and passes otherwise (and then of course, later on I will run
can I deploy
on each of the pipelines that actually deploy any given version of the producer and the provider)
m
if the
pactVerify
from the provider’s gitlab’s pipeline fails 1/10 released consumer versions (eg the very first version of the consumer, but passes all the other 9 ones, including the latest) ... would the total result be
PASSED
or
FAILED
the result would be
FAILED
, unless the pacts are pending (docs.pact.io/pending).
To achieve what you want there, I would just run multiple verification jobs with the various selectors, and then fail/not-fail the step based on the behaviour you are after
👍 1
a
what I did in the end was run the pactVerify against all versions in branch main (but allow this step to fail the pipeline, as the aim is simply historical breaking changes) and setup the blocker for merging with
can-i-merge
checking against the latest version of pacts from all consumers and setup the blocker for deploying with
can-i-deploy
which would check the deployed version of all consumers of this producer in that given environment
👌 1
🙌 1
m
That works too!
thankyou 1
a
btw thanks a lot for replying to all these threads, very appreciated to have help from someone who knows pact.... when it's your first time and no one in your company knows pact it can get pretty lonely not having someone to bounce ideas / challenge you back with good practices, thanks a lot!
happy hearts 2
y
That is lovely feedback! I can empathise with how you feel, and glad that the Slack community is working for empowering you to get to Pact Nirvana. The more we can empower champions in orgs to love Pact and rave about it, the better. Matt is incredibly knowledgable and a seal of a approval from him is like chefkiss
🙌 1
a
Pact Nirvana
I am going to quote this in the blogpost that I'll write at the end of our implementation, hope you dodn't mind?
1000 1
y
No of course, it’s not my original quote. I do ❤️ Nirvana and am a grunge kid, but the quote came from Beth https://docs.pact.io/pact_nirvana Awesome to hear you are writing a blog. You will have to let us know when its written and we can cross promote it via our Pact blog and get it listed on our community articles page
👍 1
a
nirvana
🤘 1
m
You’re most welcome Anna, we love hearing from the community and more than happy to provide that support. Smells like teen spirit was one of the first songs I learned on my guitar too (well, just the riff 😛 ) - so it was a good choice. Only later in life did I come to appreciate meditation and realise what the real “nirvana” meant - one day we’ll all get there!
🧘 1