# Jenkins Controller Extractor (`datamule/jenkins-controller-extractor`) Actor

Point at any Jenkins or Hudson controller (anonymous-read) and get one structured row per job or build: status, results, timings, build history, job graph. Works on any controller via the standard /api/json Remote Access API.

- **URL**: https://apify.com/datamule/jenkins-controller-extractor.md
- **Developed by:** [Datamule](https://apify.com/datamule) (community)
- **Categories:** Developer tools, Business
- **Stats:** 3 total users, 1 monthly users, 96.6% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.35 / 1,000 records

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Jenkins Controller Extractor

Point at **any** Jenkins or Hudson controller and get clean, structured data out
of its standard **Remote Access API** (`/api/json`) — no per-host scraper, no
setup. Every Jenkins controller (the dominant self-hosted CI server) speaks the
identical documented API, and a large population of open-source project
controllers leaves anonymous read enabled, so their **job graph and build
history** are yours in one call.

### What it does

Three modes, auto-selected from your input:

| Mode | When | Output |
|------|------|--------|
| **jobs** (default) | just a `baseUrl` | one row per job on the whole controller, each with its last-build result, status, and timings. Jenkins **folders** are recursed into so nested jobs surface too. |
| **builds** | set a `job` | one row per recent build of that single job — result, duration, timestamp, building flag. |
| **discovery** | `mode = discovery` | one row describing the controller itself — Jenkins version, job count, node mode, security. |

### Input

- **baseUrl** (required) — the controller root, e.g. `https://jenkins.debian.net`
  or `https://ci.adoptium.net`. The `/api/json` path is added for you.
- **mode** — `jobs` (default) · `builds` · `discovery`. Leave empty to
  auto-select (jobs, or builds when a `job` is set).
- **job** — (builds mode) a job name, a nested `folder/child` path, or a full job
  URL.
- **buildDepth** — (builds mode) how many recent builds to fetch (default 10).
- **foldersRecurse** / **maxFolderDepth** — (jobs mode) recurse into folders
  (default on, depth 3).
- **maxRecords** — a global cap on rows (each row is one billable event).
- **bearer** / **extraHeaders** — optional auth for a private / rate-limited
  controller. Never required for public controllers; never logged.

### Output

One flat row per job or build. Jobs carry: `jobName`, `jobType`
(freestyle / pipeline / multibranch / matrix / maven / folder / …), `jobClass`,
`folderPath`, `url`, `color`, `statusText`, `buildable`, `inQueue`, and a
`lastBuild*` summary (number, result, timestamp, duration, url). Builds carry:
`buildNumber`, `result`, `timestamp`, `durationMs`, `building`, `url`. Every row
also has controller meta (`_source`, `_software`, `_version`, `_jobCount`) and a
lossless `_raw` copy of the original API entry. Timestamps are ISO-8601 UTC.

### Notes

- Works on any controller that allows **anonymous read** of its API. For gated
  controllers, supply a `bearer` token or `extraHeaders`.
- A controller with no jobs, or a job with no build history, returns 0 rows and a
  clean run — it never invents data.
- Pay-per-event: one event per row returned.

### Example

```json
{ "baseUrl": "https://jenkins.debian.net/", "maxRecords": 25 }
```

```json
{ "baseUrl": "https://ci.adoptium.net/", "job": "build-scripts/openjdk21-pipeline", "buildDepth": 20 }
```

# Actor input Schema

## `baseUrl` (type: `string`):

Root URL of a Jenkins or Hudson controller. Every Jenkins controller exposes the identical Remote Access API at /api/json, so one actor works against any of them: https://jenkins.debian.net, https://ci.adoptium.net, or any self-hosted / corporate / university controller that allows anonymous read. The /api/json path is appended for you (paste the controller root). The run MODE is chosen automatically from the other fields you set (see below).

## `mode` (type: `string`):

What to extract. jobs (default): one row per job on the whole controller, with each job's last-build result. builds: the recent build history of ONE job (set the Job field) — one row per build. discovery: a single row describing the controller itself (Jenkins version, job count, security mode). Leave unset to auto-select: jobs, unless a Job is set (then builds). Pick a value here to force a specific mode (e.g. discovery).

## `job` (type: `string`):

BUILDS MODE. The job whose recent build history to fetch. Accepts a simple job name (my-job), a nested folder path (my-folder/my-job), or a full job URL (https://ci.adoptium.net/job/build-scripts/job/openjdk21-pipeline/). Setting this auto-selects builds mode. One row is emitted per build (result, timing, timestamp).

## `buildDepth` (type: `integer`):

BUILDS MODE. How many of the most recent builds to fetch for the Job (newest first). Default 10. Capped at 500. Ignored in jobs / discovery mode.

## `foldersRecurse` (type: `boolean`):

JOBS MODE. Jenkins organizes jobs into folders (Folder / Organization Folder plugins). When true (default), the actor recurses into folder jobs to surface the nested jobs too, up to the Max folder depth. When false, only the jobs at the controller root level are returned (folders appear as single rows).

## `maxFolderDepth` (type: `integer`):

JOBS MODE. How many levels of nested folders to recurse into when Recurse into folders is on. Default 3, capped at 8. A controller with deep folder trees (e.g. multibranch pipelines) may nest several levels.

## `maxRecords` (type: `integer`):

A GLOBAL cap across jobs and builds. The default and prefill cap the run at 25 rows. Each emitted row is one `record` PPE event at the current FREE unit price of $0.0005, so the maximum example event charge is $0.0125, excluding Apify infrastructure cost. Jobs-mode folder recursion and builds-mode history stop deterministically as soon as the global cap is reached; lower it for a smaller sample or explicitly raise it for broader extraction.

## `bearer` (type: `string`):

Optional access token for a private / registration-required / rate-limited controller (sent as Authorization: Bearer \*\*\*). Not required for public controllers that allow anonymous read. Never logged.

## `extraHeaders` (type: `object`):

Optional extra HTTP headers as a JSON object, e.g. {"Jenkins-Crumb": "..."} or a cookie for gated controllers. Not required for public controllers. Header values are never logged.

## Actor input object example

```json
{
  "baseUrl": "https://jenkins.debian.net/",
  "buildDepth": 10,
  "foldersRecurse": true,
  "maxFolderDepth": 3,
  "maxRecords": 25
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "baseUrl": "https://jenkins.debian.net/",
    "maxRecords": 25
};

// Run the Actor and wait for it to finish
const run = await client.actor("datamule/jenkins-controller-extractor").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "baseUrl": "https://jenkins.debian.net/",
    "maxRecords": 25,
}

# Run the Actor and wait for it to finish
run = client.actor("datamule/jenkins-controller-extractor").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "baseUrl": "https://jenkins.debian.net/",
  "maxRecords": 25
}' |
apify call datamule/jenkins-controller-extractor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,datamule/jenkins-controller-extractor"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/U8nucpadfWwXsUfhZ/builds/xByzjZL94fgRn4o7V/openapi.json
