Hi all, I tried implementing an MVP based on `pact...
# pactflow
s
Hi all, I tried implementing an MVP based on
pact-workshop-js
. I got the consumer, provider & Pactflow broker working together & CI setup (using Drone CI). Most documentation mentions tags for tagging pacts & specifying which pacts to verify, however, it is suggested to use environments & releases/deployments instead of tags for newer versions. Our usual git flow is to create feature branches, raise a PR & merge to
main
. From main, we can promote (deploy) to staging or production. I'm quite confused as to what the pipelines should look like and which pact versions to verify where. I have configured a webhook for the
contract_requiring_verification_published
event to trigger a verification pipeline for the provider. But there is also a
provider_verification_published
event; should that trigger a consumer pipeline via a Pactflow webhook too? Also, although the webhook to trigger the provider build should only trigger on contract changes, it seems to trigger every time. Could someone perhaps take the time to do a Zoom call with me and go over my existing setup?
m
But there is also a
provider_verification_published
event; should that trigger a consumer pipeline via a Pactflow webhook too?
no you shouldn’t need that, that sounds like a recipe for build loops that could go on forever 😆 (although the “contract requiring verification” should filter out duplicate contracts)
You’re right, we are in the final stages of finishing the work fro branches/releases, and the docs / workshops are last to update
b
@Stefan Tertan have you done the CI/CD workshop? https://docs.pactflow.io/docs/workshops/ci-cd/
This walks you through all the webhook set up, though as Matt says, there is a slight update to the webhook configuration for the new “contract published requiring verification” webhook.
It sounds like you’ve got that working already though.
Your workflow will match the CI/CD workshop example perfectly. I think it will answer your questions.
s
hi Beth, the workshop is a bit outdated , even the
feat/10.x.x-upgrade
branch still uses tags:
Copy code
//consumerVersionTag: ['master', 'prod'], //the old way of specifying which pacts to verify
consumerVersionSelectors: [{ tag: 'master', latest: true }, { deployed: true } ], // the new way of specifying which pacts to verify
I'm doing the below, but am not sure if it's correct:
Copy code
consumerVersionSelectors: [
    {deployed: true, environment: 'staging-uk'},
    {deployed: true, environment: 'production-uk'},
],
I'm gonna go over the Pactflow Workshop on that link you provided.... hopefully it will help clear the issues that I'm facing 👍
m
The JS workshop really takes you up to the point of where a broker would come in, where the CI/CD workshop would kick in
It's more about the mechanics of contract testing, not the CI/CD integration
s
thanks, it's good to know 👍
m
We'll be updating the docs and workshops soon to reflect this latest thinking (branches/environments)
b
This is the recommended config for the consumer version selectors https://docs.pact.io/provider/recommended_configuration
🙏 1