- related repository - pact-provider-poc
pnpm install
pnpm start
-
validate producer expectations and generate contract
pnpm test:pact
5. Pact CLI
-
setup environment vars
- bash
export PACT_BROKER_BASE_URL=https://domain.pactflow.io export PACT_BROKER_TOKEN=*****
- powershell
[System.Environment]::SetEnvironmentVariable('PACT_BROKER_BASE_URL','https://domain.pactflow.io') [System.Environment]::SetEnvironmentVariable('PACT_BROKER_TOKEN','*****')
-
Publish contract to PactFlow.io
$hash=git rev-parse --short head
$branch=git rev-parse --abbrev-ref head
docker run --rm `
-w /opt/pact `
-v ${PWD}/pact/pacts:/opt/pact `
-e PACT_BROKER_BASE_URL `
-e PACT_BROKER_TOKEN `
pactfoundation/pact-cli:latest publish . `
--consumer-app-version $hash `
--branch $branch
- Can I deploy
$hash=git rev-parse --short head
docker run --rm `
-e PACT_BROKER_BASE_URL `
-e PACT_BROKER_TOKEN `
pactfoundation/pact-cli:latest pact-broker can-i-deploy `
--pacticipant pact-consumer-poc `
--version $hash `
--to-environment test
- Record deployment/release
$hash=git rev-parse --short head
docker run --rm `
-e PACT_BROKER_BASE_URL `
-e PACT_BROKER_TOKEN `
pactfoundation/pact-cli:latest pact-broker record-deployment `
--pacticipant pact-consumer-poc `
--version $hash `
--environment test