> ## Documentation Index
> Fetch the complete documentation index at: https://checklyhq.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# CI/CD

> Core to our Monitoring as Code approach is running your checks from your CI/CD pipeline and use them as E2E tests.

Regardless of the provider or platform you use, integrating Checkly into your CI/CD pipeline boils down to **four basic steps**:

1. Store your checks as code and `git push`. Preferably store your checks alongside your application code. Just like unit tests.
2. Wait for your application to be deployed. This can be done through hooks, lifecycle events or wait scripts.
3. Run your checks using `npx checkly test` and pass in any variables like an `ENVIRONMENT_URL`.
4. If the checks pass successfully, run `npx checkly deploy`.

With this approach, you can validate your application and infrastructure before deploying to production, staging or any other environments.
Simultaneously , you can life cycle (create/update/delete) your checks from your code base as part of your CI/CD workflow.

## 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](/cli).

<Columns cols={3}>
  <Card title="GitHub Actions" icon="https://mintcdn.com/checkly-422f444a/oKreJ12T0nCfIDb_/images/github-icon-dark.svg?fit=max&auto=format&n=oKreJ12T0nCfIDb_&q=85&s=0bc77a059e229683529c21f9b82802eb" href="/integrations/ci-cd/github/actions" width="24" height="24" data-path="images/github-icon-dark.svg">
    Run the Checkly CLI from GitHub Actions, export summary reports and integrate with mono repos
  </Card>

  <Card title="GitLab CI" icon="https://mintcdn.com/checkly-422f444a/oKreJ12T0nCfIDb_/images/gitlab-logo.svg?fit=max&auto=format&n=oKreJ12T0nCfIDb_&q=85&s=96c98815fc48031fa17179d32b410a0b" href="/integrations/ci-cd/gitlab/overview" width="128" height="128" data-path="images/gitlab-logo.svg">
    Run the Checkly CLI from GitLab CI pipelines, using separate e2e-test and deploy jobs.
  </Card>

  <Card title="Jenkins" icon="https://mintcdn.com/checkly-422f444a/Vk5L_RINdMXmLv3a/images/jenkins-logo.svg?fit=max&auto=format&n=Vk5L_RINdMXmLv3a&q=85&s=121115e043f8b4bc749a4b14dba54f66" href="/integrations/ci-cd/jenkins/overview" width="180" height="180" data-path="images/jenkins-logo.svg">
    Run the Checkly CLI from a Jenkins pipeline using a Jenkinsfile.
  </Card>
</Columns>

## CI/CD Integration using vendor webhooks

* [Vercel](/integrations/ci-cd/vercel/overview)
* [GitHub deployments](/integrations/ci-cd/github/deployments)

## CI/CD Basics

We've optimized the [Checkly CLI](/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.

1. For **authentication**, make sure to set the `CHECKLY_API_KEY` and `CHECKLY_ACCOUNT_ID` parameters as environment variables
   in your CI/CD platform.
2. Set the **reporter** you want to use for the `test` command using the `--reporter` flag, i.e. `--reporter=dot`.
3. Use `npx checkly test` to validate your checks before deploying. Test results, traces, and videos are available in Checkly as a **test session**.
4. Use the `--force` flag on the `deploy` and / or `destroy` commands to skip the normal confirmation steps.

The CLI will attempt to parse `git` specific information from the environment to display in the test session as metadata.
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"        |
