- Get (and set) your PACT environment variables by clicking 'Copy Env Vars' for Read/write token (CI).
(used in pact section of build.gradle)
export PACT_BROKER_BASE_URL=https://[user].pactflow.io
export PACT_BROKER_TOKEN=NotMyRealBrokerToken
- Create dev, staging and prod environments in pactflow Remember to mark 'prod' as a Production environment when asked.
- Download the standalone pact-cli and add to your $PATH
export PATH=$HOME/bin/pact/bin:$PATH
or via brew
/gradlew clean pactTest --tests "*ProviderPactTest"
./gradlew clean -DpactPublishResults=true test --tests "*ProviderPactTest"
The provider version and branch are also set. See test section of build.gradle
Choose one of the following options:
- gradle: At time of writing the pact gradle canIDeploy task does not support branches and environments.
- pact-cli:
pact-broker can-i-deploy --pacticipant=$(basename `git rev-parse --show-toplevel`) --version=$(git rev-parse HEAD) --branch=$(git rev-parse --abbrev-ref HEAD) --to-environment=dev
** Remember to replace the--to-environment
with the environment you want to check if you can deploy too.
To get can-i-deploy to pass you need to make sure all consumer tests have passed. See pact-mobile-app
After the provider tests have passed and the service has been deployed to an environment we should record a deployment
Choose one of the following options:
- gradle: At time of writing the pact gradle plugin does not support recording a deployment
- pact-cli:
pact-broker record-deployment --pacticipant=$(basename `git rev-parse --show-toplevel`) --version=$(git rev-parse HEAD) --environment=dev
When a version has been deployed to production we should record a release.
- gradle: At time of writing the pact gradle plugin does not support recording a deployment
- pact-cli:
pact-broker record-release --pacticipant=$(basename `git rev-parse --show-toplevel`) --version=$(git rev-parse HEAD) --environment=prod