Use Courier in CI
courier run exits with 1 when a request or test fails, so a CI job fails with it. Point it at a folder of checks and an environment.
courier run api-checks --env staging --var token="$API_TOKEN" --reporter junit -o courier.xmlReports
Section titled “Reports”| Reporter | Use it for |
|---|---|
--reporter junit -o report.xml |
Test dashboards in GitHub Actions, GitLab, Jenkins and others |
--reporter json -o report.json |
Your own scripts |
--reporter html -o report.html |
A page to read: a summary, every request with its status, time and tests, and failures opened with their response body |
Secrets are masked in all three. See courier run.
Keep secrets out of the repository
Section titled “Keep secrets out of the repository”- Pass secrets with
--var name=valuefrom your CI’s secret store. Names that look secret, such astokenorpassword, are masked in reports. - Or use secret references that the runner can resolve, such as
secret://vault/…withVAULT_ADDRandVAULT_TOKENset.
Check that requests match the spec
Section titled “Check that requests match the spec”Add a step that fails when your requests and your OpenAPI spec drift apart:
courier sync openapi.yaml api-checks --env stagingSee OpenAPI sync.