Skip to main content

Verification - Consumer change

## Provider verification tasks performed on contracts requiring verification

Configuring the branch when publishing verification results

See here for full docs.

pact-provider-verifier  \
--provider "Example API" \
--provider-app-version $GIT_COMMIT \
--provider-version-branch $GIT_BRANCH \
...

Verification triggered by a contract requiring verification published

When a pact has changed, a webhook in the Pact Broker will kick off a build of the provider, passing through the URL of the pact that has changed. See this section of the CI/CD set up guide for more information on this.

Using this webhook event allows the changed pact to be tested against the head of the providers main branch and any deployed or released versions of the provider, in the same way as the consumer version selectors can be configured to allow the head of the consumers main branch and any deployed or released versions of the pact to be tested against a version of the provider.

More details on the webhook can be found in the webhook documentation

When the pact URL is known, the pactBrokerUrl, providerName, consumerVersionSelectors/consumerVersionTags, enablePending, includeWipPactsSince fields should not be set. You can see an example of switching between the two verification modes (all vs changed) in this Node example

Examples

You can find samples in our webhook template library for common build systems and see below for how to configure your provider build to use the pact URL.

const verificationOptions = {
pactUrls: [process.env.PACT_URL],

// used when publishing verification results

publishVerificationResult: process.env.CI === "true", //only publish from CI
providerVersion: process.env.GIT_COMMIT, //use the appropriate env var from your CI system
providerVersionBranch: process.env.GIT_BRANCH // if using branches and environments (recommended)
providerVersionTags: process.env.GIT_BRANCH ? [process.env.GIT_BRANCH] : [], // optional, it is recommend you set the branch as well.
}