# Jenkins

<div class="view-markdown-wrapper">
<ViewMarkdown />
</div>

Run your Shiplight E2E tests in a Jenkins pipeline and upload the results to [Shiplight Cloud](https://app.shiplight.ai). Jenkins uses the same `shiplight` CLI as every other provider — only the pipeline syntax differs.

## Before you start

- A scaffolded Shiplight test project (`/shiplight init`). See the [CI/CD overview](/local/ci) for how the pieces fit together.
- An org API token from [app.shiplight.ai/api-tokens](https://app.shiplight.ai/api-tokens), stored as a **Secret text** credential (**Manage Jenkins → Credentials**). The template references it by ID `shiplight-api-token`.
- A **Pipeline** job pointing at your repository — Jenkins does not auto-discover a `Jenkinsfile`, so create the job once and set its SCM to your repo.

## Pipeline

Create a `Jenkinsfile` at your repository root:

```groovy
pipeline {
  agent { docker { image 'node:22' } }
  environment {
    CI = 'true'
    SHIPLIGHT_API_TOKEN = credentials('shiplight-api-token') // Jenkins credential ID
  }
  stages {
    stage('Install') {
      steps {
        sh 'curl -fsSL https://bun.sh/install | bash'
        sh 'export PATH="$HOME/.bun/bin:$PATH"; bun install'
        sh 'export PATH="$HOME/.bun/bin:$PATH"; bun run playwright install --with-deps chromium'
      }
    }
    stage('E2E tests') {
      steps {
        sh 'export PATH="$HOME/.bun/bin:$PATH"; bun run shiplight test'
      }
    }
  }
}
```

## Notes

- `SHIPLIGHT_API_TOKEN` enables completed test report uploads; set it as a Jenkins secret.
- `CI=true` plus `SHIPLIGHT_API_TOKEN` enables the shared Shiplight Cloud action cache. AI-powered actions can self-heal through the Shiplight LLM proxy, and healed locators from passing tests are reused by later runs.
- Install Chromium yourself (`bun run playwright install --with-deps chromium`); no stock image ships it.
- **Failure triage on Jenkins:** classification runs on the server for uploaded runs from any provider, but the optional autofix workflow ([auto-triage](/local/ci#auto-triage-failures)) is GitHub Actions only.
- Project in a subdirectory (e.g. `tests/e2e`)? Wrap the steps in `dir('tests/e2e') { … }`.

## Related

- [CI/CD overview](/local/ci) · [Custom setups](/local/ci/custom) · [CLI Reference](/local/cli-reference)
