- Store your checks as code and
git push
. Preferably store your checks alongside your application code. Just like unit tests. - Wait for your application to be deployed. This can be done through hooks, lifecycle events or wait scripts.
- Run your checks using
npx checkly test
and pass in any variables like anENVIRONMENT_URL
. - If the checks pass successfully, run
npx checkly deploy
.
CI/CD Integration with the Checkly CLI
The preferred and most flexible way to integrate Checkly with your CI/CD is through the Checkly CLI.GitHub Actions
Run the Checkly CLI from GitHub Actions, export summary reports and integrate with mono repos
GitLab CI
Run the Checkly CLI from GitLab CI pipelines, using separate e2e-test and deploy jobs.
Jenkins
Run the Checkly CLI from a Jenkins pipeline using a Jenkinsfile.
CI/CD Integration using vendor webhooks
CI/CD Basics
We’ve optimized the Checkly CLI to work in any CI/CD workflow. Here are the basics you need to know that will come in handy when adapting the examples we give you to your own, specific setup.- For authentication, make sure to set the
CHECKLY_API_KEY
andCHECKLY_ACCOUNT_ID
parameters as environment variables in your CI/CD platform. - Set the reporter you want to use for the
test
command using the--reporter
flag, i.e.--reporter=dot
. - To store a test session with full logging, traces and vides, set the
--record
flag for thetest
command. - Use the
--force
flag on thedeploy
and / ordestroy
commands to skip the normal confirmation steps.
--record
flag, the CLI will attempt to parse git
specific information from
the environment to display in the recorded test session as metadata. However, you can also set these data items specifically
by using environment variables.
item | auto | variable | description |
---|---|---|---|
Repository | false | repoUrl in checkly.config.ts or CHECKLY_REPO_URL | The URL of your repo on GitHub, GitLab etc. |
Commit hash | true | CHECKLY_REPO_SHA | The SHA of the commit. |
Branch | true | CHECKLY_REPO_BRANCH | The branch name. |
Commit owner | true | CHECKLY_REPO_COMMIT_OWNER | The committer’s name or email. |
Commit message | true | CHECKLY_REPO_COMMIT_MESSAGE | The commit message. |
Environment | false | CHECKLY_TEST_ENVIRONMENT | The environment name, e.g. “staging” |