Configure consumer pipeline
The source repositories are configured to use the Pactflow Github and Travis accounts, and the public broker at test.pactflow.io. You will need to update these settings to point to your own accounts.
.travis.ymlof the example-consumer project, set
PACT_BROKER_BASE_URLto the base URL of your own Pactflow account (you will have received an email with this information).
- To update the encrypted
PACT_BROKER_TOKENyou will need to use the Travis CI CLI which is released as a Rubygem. To avoid having to install yet another dependency, we are using the
lirantal/travis-clidocker image, which coincidentally is maintained by a long time Pact fan and user, the awesome @lirantal.
Log in to your Pactflow account (
https://<your-subdomain>.pactflow.io), and go to Settings > API Tokens.
Click the Copy button for the read/write CI token.
Open a terminal in the directory where you checked out your example-consumer.
export PACT_BROKER_TOKEN="<paste your token here>" make travis_login # you'll need to input your github credentials and 2FA if configured make travis_encrypt_pact_broker_token
Copy the output of the encrypt command, including the quotation marks, and replace the
- secure:value in the
env > globalsection of your
Commit and push the changes to your
Open the example-consumer project in Travis CI. This build should now successfully publish the pact, but it will fail on the
can-i-deploystep when it tries to deploy. This is because the provider has not published a successful verification result for the pact.
NOTE: If you're unable to generate an encrypted token here, you can also set the credentials directly in Travis. Go to
https://travis-ci.com/github/<your org>/<your project>/settingsand choose "More options" > "Settings" > "Environment Variables" and set the
Configure provider pipeline
🔁 Repeat the above instructions to configure the Pactflow account for your provider project.
- You shouldn't need to repeat the Travis login step.
- The environment variable must be encrypted in the context of the repository to which it will be added, so you can't just reuse the output of the encrypt step from the consumer project.
After you have pushed your changes to
.travis.yml, the provider pipeline will run, fetching and verifying the configured pacts from your Pactflow account, and publishing the results back. The
can-i-deploy command will pass, and allow the provider to be deployed.
Back to the consumer
✅ If you would like to see all your builds go green, you can re-trigger the consumer build by selecting "More options" > "Trigger build" > "Trigger custom build".
Expected state by the end of this step
Both consumer and provider builds passing.