# 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:20' } }
  environment {
    SHIPLIGHT_REPORT_TO_CLOUD = '1'
    SHIPLIGHT_API_TOKEN = credentials('shiplight-api-token') // Jenkins credential ID
  }
  stages {
    stage('Install') {
      steps {
        sh 'npm install'
        sh 'npx playwright install --with-deps chromium'
      }
    }
    stage('E2E tests') {
      steps {
        sh 'npx shiplight test'
      }
      post {
        always {
          sh 'npx shiplight report' // upload even when tests fail
        }
      }
    }
  }
}
```

## Notes

- `SHIPLIGHT_API_TOKEN` and `SHIPLIGHT_REPORT_TO_CLOUD=1` are required on every non-Shiplight runner — they are provided automatically only on [Shiplight-hosted GitHub runners](/local/ci/github-actions).
- Install Chromium yourself (`npx playwright install --with-deps chromium`); no stock image ships it.
- The `post { always { … } }` block is what makes the upload survive a red run.
- **Not available on Jenkins:** Shiplight-hosted runners, the self-healing action cache, automatic LLM credentials, and [auto-triage](/local/ci/github-actions#auto-triage-ci-failures-optional) — those are 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)
