And what is the value we should pass to those vari...
# pact-broker
s
And what is the value we should pass to those variables?
b
You don’t pass in those variables in the webhook -the webhook fills the variables in for you from values you have previously provided.
this 1
If you’re using one of the libraries that supports branches, you should be populating the branch with the git branch. Guide here: https://docs.pact.io/provider/recommended_configuration
s
We use providersbranch and providertag for pending pact verification right
In that case what is the value that gets assigned to it. PR branch or Master branch
y
It depends on the webhook used, there is a new one, which supercedes the previous and checks against the latest on your mainBranch and any deployedOrReleased This table shows the difference in coverage https://docs.pact.io/pact_broker/webhooks#using-webhooks-with-the-contract_requiring_verification_published-event
Tags traditionally represented pseudo-branches in 99% of peoples workflows, whilst also representing environments. so branches became a first-class property of the Pact Broker, along with a new concept of environments, and the notion of recording deployments (or releases) to them. Tags whilst still supported, are being phased out from our recommended configuration, and you should see some docs changes over the next couple of weeks to support this
b
PR branch or Master branch
Which ever branch is running the build.
PR branch if it’s a PR, master branch if it’s master.
We use providersbranch and providertag for pending pact verification right
The branch name is used for lots of things.
Calculating pending, working out what the WIP pacts are, triggering the right builds for the webhooks.
s
So having a stages like this is enough to cover
contract_requiring_verification_published
and
pending
and
WIP pact?
Pact verification build template:
Copy code
stage('Contract Tests: Provider Verify') {
                    steps {
                        sh """mvn test -Pcontract-tests-provider-verify \
                            -Dpact.verifier.publishResults=true \
                            -Dpact.provider.version=${GIT_COMMIT} \
                            -Dpact.provider.branch=${BRANCH_NAME} \
                            -Dpact.filter.pacturl=${params.pactUrl}"""
                    }
                }
In main build template:
Copy code
stage('Contract Tests: Provider Verify') {
                    when {
                        expression { PACT_PROVIDER == true }
                    }
                    steps {
                        sh """mvn test -Pcontract-tests-provider-verify \
                        -Dpact.verifier.publishResults=true \
                        -Dpact.provider.version=${GIT_COMMIT} \
                        -Dpact.provider.branch=${GIT_BRANCH} \
                        -Dpactbroker.providerBranch=${GIT_BRANCH}\
                        -Dpact.broker.consumerversionselectors.rawjson=[{"mainBranch":true},{"deployed":true}]"""
                    }
                }
b
Not sure why you need these both:
Copy code
Dpact.provider.branch=${GIT_BRANCH}
Dpactbroker.providerBranch=${GIT_BRANCH}
I have never used pact jvm, so you’d be best to check in the pact-jvm channel.
it does seem right to me though.
I don’t know. I’ve never used pact-jvm.
s
Copy code
Dpact.provider.branch=${GIT_BRANCH}
Dpactbroker.providerBranch=${GIT_BRANCH}
Are they the same?
From my understanding,
Copy code
Dpact.provider.branch=${GIT_BRANCH} --> this is for registering provider's branch name
Dpactbroker.providerBranch=${GIT_BRANCH} --> this is for enabling pending pact??
b
Please ask in the #C9UN99H24 channel. I cannot help you. I have never used pact-jvm.
s
Okay