jenkins-rest-ops

Drive Jenkins Remote Access REST API operations with curl for builds, jobs, and queue polling.

1|1|Updated May 24, 2026
One-click install
npx skills add https://github.com/bm629/agent-skills --skill jenkins-rest-ops-bm629
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: jenkins-rest-ops
Source: https://github.com/bm629/agent-skills/tree/main/skills/jenkins-rest-ops
Command: npx skills add https://github.com/bm629/agent-skills --skill jenkins-rest-ops-bm629

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires curl, jq, and includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve? Driving a Jenkins server programmatically usually means pulling in an SDK or CLI, and the most common failure — treating an async build trigger as if it returned a build — produces wrong results. This Skill lets an agent perform Jenkins CI/CD operations directly against the Remote Access REST API with curl, handling the queue-item polling flow, token auth, and CSRF crumb fallback correctly. ## Core Features & Use Cases - Async build lifecycle: Trigger builds via build/buildWithParameters, poll the queue item to the executable build, then read status and console logs. - Job and build management: List and inspect jobs, views, queue, and nodes; create, copy, delete, enable, and disable jobs via config.xml; stop or delete builds. - Grounded endpoint index: An authoritative CORE path table built from official Jenkins docs, with the unofficial swaggy-jenkins OpenAPI bundled only as a schema cross-check. - Use Case: Ask the agent to trigger a parameterized build of a job, wait for it to finish, and report the result plus the console log — it triggers, polls the queue item, reads the final status, and fetches the log without ever exposing the API token. ## Quick Start Use jenkins-rest-ops to trigger a build of my deploy job with BRANCH=main, wait for it to finish, and show me the result and console log.

Frequently Asked Questions about jenkins-rest-ops

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I trigger a Jenkins build via the REST API?

POST to job/<name>/build for an unparameterized job or job/<name>/buildWithParameters with form data for a parameterized one. The response is 201 with a Location header pointing to a queue item, not a build, so you must poll queue/item/<id>/api/json until .executable appears.

Why does my Jenkins build trigger return no build number?

A build trigger is asynchronous and returns a queue item, not a build. Poll the queue item URL until .executable.number and .executable.url appear, then read the build at that URL. Reading lastBuild immediately can return a previous build.

Does Jenkins API token auth need a CSRF crumb?

No. Since Jenkins 2.96 weekly and 2.107 LTS, HTTP Basic auth with an API token is exempt from the CSRF crumb. Only fetch a crumb from crumbIssuer/api/json if a POST returns 403 No valid crumb; a 404 on that endpoint means CSRF is disabled.

Why does POST job/build return 400 Bad Request?

A parameterized job rejects the plain /build endpoint with 400 Bad Request. You must use buildWithParameters instead, even when building with the declared default parameter values and sending no overrides.

Is there an official Jenkins OpenAPI specification?

No, Jenkins ships no official OpenAPI spec (JENKINS-35808). This Skill grounds its endpoint table on the official Remote Access API docs and bundles the unofficial swaggy-jenkins spec only as a partial schema cross-check.

When should I not use direct Jenkins REST API calls?

Avoid this approach when committing a Jenkinsfile or configuring SCM webhooks, which are version-control operations, and when you need plugin-contributed endpoints, since those vary per installation and are outside the guaranteed CORE API surface.