liveBook · Manning

Provider version branch

As explained in Contract Testing in Action

A provider version branch is a Pact configuration associating a provider version with the Git branch from which it was produced.

A provider version branch associates a Pact provider version with the Git branch that produced it. In CI/CD, the provider publishes its commit version and branch, allowing verification results to remain tied to the correct branch. section 10.2.2

Configure the provider with the GITHUB_BRANCH environment variable and select contracts from the consumer’s main branch and matching branch. This replaces consumer version tags for the workflow described here. section 10.2.2

Matching feature branches

If a consumer developer creates test-pact-features, the provider developer uses the same branch name. The provider then verifies both the matching feature-branch contract and the consumer’s main-branch contract before merging. section 10.2.2

const options = {
  …
  providerVersion: process.env.GITHUB_SHA,
  providerVersionBranch: process.env.GITHUB_BRANCH,
  consumerVersionSelectors: [
    { mainBranch: true },
    { matchingBranch: true },
  ]
  …
}

A provider verification configuration pairs providerVersionBranch with consumerVersionSelectors for main-branch and matching-branch contract selection. section 10.2.2

How Contract Testing in Action covers it

How deep it goes
Explains configuration options and branch-selection behavior, but defers the complete selector property list.
Examples
Uses feature and main branches, GITHUB_BRANCH, and the MoviesAPI provider verifying WebConsumer contracts.
What it assumes
Assumes Git branches, CI environment variables, Pact contracts, and provider verification; teaches the branch configuration itself.
What you can do after
Operate/configure Pact provider verification against main and matching consumer branches.
How it connects
Connects provider versions with consumer version selectors, consumer version tags, Git branches, and contract testing.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Contract Testing in Action. The section links point to the parts of the book it draws on.