Skip to main content

Overview

Correlate failed builds and deployments with incidents. OpenSRE reads your Jenkins server over its REST API to answer: “was there a recent build or deployment that coincides with this alert?”

Prerequisites

  • Jenkins server reachable from OpenSRE
  • Jenkins username with API access
  • A Jenkins API token (not your account password)

Setup

Option 1: Interactive CLI

You will be prompted for the Jenkins URL, username, and API token. Related commands:

Option 2: Environment variables

Folder-organized jobs are supported — pass the full path, for example team/payment-service.

Credentials

Create a Jenkins API token

In Jenkins: click your username (top-right) → SecurityAPI TokenAdd new TokenGenerate. Copy the token — Jenkins shows it only once. API access uses HTTP Basic auth with your username and this token (not your password).

Quick local test with Docker

Bring up a disposable Jenkins with a pre-configured admin account (no setup wizard):
Wait for it to come up, then create and run a job so there is a real build to inspect:
admin/admin is only valid because this is a disposable local instance with anonymous read disabled — Jenkins accepts a real password over Basic auth the same way it accepts a token when no token is configured. Never do this against a real server. The empty temporary integration store prevents saved integrations from overriding the demo environment variables. Verify:
The exported variables also make Jenkins available to investigations; no separate setup step is required. Trigger a real investigation against the failing build — this exercises list_jenkins_jobs, list_jenkins_running_builds, get_jenkins_pipeline_stages, and get_jenkins_build_log in a single supported turn (not a raw internal import):
Real output from a run against this exact local build (edited for length):
list_jenkins_builds is the one registered tool not called here — list_jenkins_jobs already returned this job’s last-build number and status, so the agent went straight to get_jenkins_pipeline_stages/get_jenkins_build_log for that specific build instead of a redundant builds listing. Teardown:

Investigation tools

Example investigation

Provide the affected job name so the agent can pull its recent builds and logs:
The agent lists recent builds for the job, spots the failed one near the alert time, fetches its console log, and surfaces the failing step in the RCA.

API reference

Verify

A successful check reports the server it reached, for example:

Troubleshooting

Security

  • Use an API token, never your Jenkins password.
  • Prefer a dedicated Jenkins user with read access to the jobs OpenSRE should inspect.
  • Store credentials in .env or your secret manager — not in source control.