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

# Generic CI/CD

> Use the DevHelm CLI deploy command in any CI/CD system — GitLab, Jenkins, CircleCI, and more

The DevHelm CLI runs anywhere Node.js is available. Use it in any CI/CD system that can install npm packages and set environment variables.

## Requirements

* **Node.js 18+** installed on the CI runner
* **`DEVHELM_API_TOKEN`** environment variable set with a valid API token
* A `devhelm.yml` configuration file in your repository

## Install the CLI

```bash theme={null}
npm install -g devhelm
```

To pin a specific version:

```bash theme={null}
npm install -g devhelm@0.2.0
```

## Deploy workflow

The standard workflow is: validate → plan → deploy.

```bash theme={null}
# Validate syntax (offline, no API calls)
devhelm validate devhelm.yml

# Preview changes
devhelm plan -f devhelm.yml

# Apply changes (non-interactive)
devhelm deploy -f devhelm.yml --yes
```

The `--yes` flag skips interactive confirmation — required in CI environments.

## GitLab CI

```yaml theme={null}
deploy-monitoring:
  image: node:20
  stage: deploy
  only:
    changes:
      - devhelm.yml
  script:
    - npm install -g devhelm
    - devhelm validate devhelm.yml
    - devhelm deploy -f devhelm.yml --yes
  variables:
    DEVHELM_API_TOKEN: $DEVHELM_API_TOKEN
```

## Jenkins

```groovy theme={null}
pipeline {
    agent { docker { image 'node:20' } }
    environment {
        DEVHELM_API_TOKEN = credentials('devhelm-api-token')
    }
    stages {
        stage('Deploy Monitoring') {
            when { changeset 'devhelm.yml' }
            steps {
                sh 'npm install -g devhelm'
                sh 'devhelm validate devhelm.yml'
                sh 'devhelm deploy -f devhelm.yml --yes'
            }
        }
    }
}
```

## CircleCI

```yaml theme={null}
version: 2.1
jobs:
  deploy-monitoring:
    docker:
      - image: cimg/node:20.0
    steps:
      - checkout
      - run: npm install -g devhelm
      - run: devhelm validate devhelm.yml
      - run: devhelm deploy -f devhelm.yml --yes

workflows:
  deploy:
    jobs:
      - deploy-monitoring:
          filters:
            branches:
              only: main
```

## Bitbucket Pipelines

```yaml theme={null}
pipelines:
  branches:
    main:
      - step:
          name: Deploy monitoring config
          image: node:20
          script:
            - npm install -g devhelm
            - devhelm validate devhelm.yml
            - devhelm deploy -f devhelm.yml --yes
```

## Dry-run for PR checks

Use `--dry-run --detailed-exitcode` to gate merges:

```bash theme={null}
devhelm deploy -f devhelm.yml --dry-run --detailed-exitcode
```

| Exit code | Meaning           |
| --------- | ----------------- |
| `0`       | No changes needed |
| `10`      | Changes pending   |
| `1`       | Error             |

## Environment variables

| Variable            | Required | Description                                      |
| ------------------- | -------- | ------------------------------------------------ |
| `DEVHELM_API_TOKEN` | Yes      | API token for authentication                     |
| `DEVHELM_API_URL`   | No       | API base URL (default: `https://api.devhelm.io`) |
| `DEVHELM_ORG_ID`    | No       | Organization ID for multi-org accounts           |

## Next steps

<CardGroup cols={2}>
  <Card title="GitHub Actions" icon="github" href="/integrations/github-actions">
    Use the official setup-devhelm action for GitHub.
  </Card>

  <Card title="CI/CD pipeline guide" icon="wrench" href="/guides/ci-cd-pipeline">
    End-to-end CI/CD setup with plan previews.
  </Card>

  <Card title="Monitoring as Code" icon="file-code" href="/guides/monitoring-as-code">
    Full YAML format and deploy workflow.
  </Card>
</CardGroup>
