CLI reference
jenkins-cli inspects Jenkins for a developer's debugging workflow: discover jobs and branches, read build status, logs, test failures and pipeline stages, and trigger or stop builds. It emits agent-friendly JSON with structured errors, and works with any Jenkins instance. NDJSON writes one item per line to stdout. Current list endpoints are unpaginated; they do not expose a continuation cursor or pagination notice. AGENT NOTE: a companion Skill ("jenkins") carries the canonical usage, safety modes, and env setup and is the source of truth for driving this CLI. If you are an agent, load that Skill before composing commands. Check status with `jenkins-cli skill status`; install it with `jenkins-cli skill install`. After a CLI upgrade, refresh the Skill and reload the agent context.
Generated from the command tree, so it always matches --help.
Global flags
Persistent flags accepted by every command.
| Flag | Default | Description |
|---|---|---|
--allow-writes | false | override read-only mode (defaults.read_only / JENKINS_CLI_READ_ONLY) for this invocation |
--auth-scheme | authentication scheme (overrides environment and config) | |
--base-url | Jenkins server URL (overrides config), e.g. http://localhost:8080 | |
--config | config directory (default ~/.angelmsger/jenkins) | |
--credential-url | credential acquisition page URL (display only) | |
--fields | comma-separated dot-path fields to keep | |
--format, -f | output format: json, table or ndjson | |
--pretty | false | human-friendly mode for interactive terminal use only (agents/scripts should omit): TUI in `config init`, colorized JSON elsewhere; errors without a TTY |
--timeout | request timeout, e.g. 30s | |
--use-context | use a named context for this invocation | |
--verbose, -v | false | log request lines on stderr |
jenkins-cli auth
Log in, check identity and log out
jenkins-cli auth
jenkins-cli auth guide
Show offline credential acquisition guidance for this service
jenkins-cli auth guide
jenkins-cli auth login
Store credentials for the active context (interactive)
jenkins-cli auth login
Prompts for your Jenkins username and API token (or password), verifies them against the server, and stores the secret in the OS keychain. Requires an interactive terminal; in CI / agent sandboxes set JENKINS_USER + JENKINS_TOKEN (or JENKINS_PASSWORD) instead.
jenkins-cli auth logout
Remove the stored credential for the active context
jenkins-cli auth logout
jenkins-cli auth reuse
Reuse an existing login in the selected context without signing in again
jenkins-cli auth reuse [flags]
Match stored contexts by complete service URL, authentication scheme and service scope. Verify a matching stored credential before filling a missing personal identity in the selected context. Never copy secrets, replace an existing identity, activate a context, or read credentials from environment variables. Dry-run performs read-only verification and reports the same proposed association. An unchanged or unavailable result is not proof of authentication; use auth status to check.
Options
| Flag | Default | Description |
|---|---|---|
--dry-run | false | verify and preview the identity association without writing |
--from-context | choose a matching source from config get-contexts when multiple identities are available |
jenkins-cli auth status
Show the active identity and verify connectivity
jenkins-cli auth status
jenkins-cli build
Inspect builds: status, logs, stages, tests, changes
jenkins-cli build
A build is one run of a job. List a job's history, then drill into a build's result, console log, pipeline stages, test failures or SCM changes. A build reference is a number or a permalink keyword: last, lastSuccessful, lastFailed, lastCompleted, lastStable (default: last).
jenkins-cli build artifacts
List a build's archived artifacts
jenkins-cli build artifacts <path> [ref]
Returns the build's archived artifacts with a direct download URL for each.
jenkins-cli build changes
Show the SCM commits in a build
jenkins-cli build changes <path> [ref]
Returns the source-control changes a build picked up: commit id, author, message and affected paths. Works for both freestyle and pipeline jobs.
jenkins-cli build get
Get one build: result, timing, trigger cause, commit
jenkins-cli build get <path> [ref]
Returns a build's result and status, when it started (absolute and relative) and how long it ran, which node it ran on, what triggered it, any build parameters, and the Git commit the job built (revision). ref defaults to the latest build.
jenkins-cli build list
List a job's recent builds (newest first)
jenkins-cli build list <path> [flags]
Returns a job's build history: number, status, start time (and how long ago), duration and what triggered each build. Use --limit to control how many builds come back.
Options
| Flag | Default | Description |
|---|---|---|
--limit | 20 | number of builds to return |
jenkins-cli build log
Print a build's console output
jenkins-cli build log <path> [ref] [flags]
Prints the build's console log as plain text to stdout. Use --start to resume from a byte offset, or --follow to stream new output until the build finishes (Ctrl-C to stop). ref defaults to the latest build. Resolve a permalink with build get and reuse its number before resuming or following: offsets belong to one build. --timeout limits each request, not the overall follow loop. Agents should set a host-side deadline.
Options
| Flag | Default | Description |
|---|---|---|
--follow | false | stream new output until the build finishes (Ctrl-C to stop) |
--start | 0 | start byte offset into the console log |
Examples
jenkins-cli build get my-app lastFailed
# If build get returned number 128:
jenkins-cli build log my-app 128
jenkins-cli build log my-app 128 --start 1024 --follow
jenkins-cli build stages
Show a Pipeline build's stage-by-stage status
jenkins-cli build stages <path> [ref]
Returns each Pipeline stage with its status and duration, so you can see exactly which stage failed. Applies to Pipeline / multibranch jobs only.
jenkins-cli build stop
Abort a running build (write)
jenkins-cli build stop <path> <ref> [flags]
Aborts the build at <path> #<ref>. With --dry-run, print the request that would be sent and exit. This is a write: it is blocked in read-only mode unless --allow-writes is given.
Options
| Flag | Default | Description |
|---|---|---|
--dry-run | false | print the request without stopping the build |
jenkins-cli build tests
Show a build's test results
jenkins-cli build tests <path> [ref] [flags]
Returns the build's test totals plus the individual cases. Use --failed-only to keep just the failing cases (with their error details) — the high-signal view when triaging a red build.
Options
| Flag | Default | Description |
|---|---|---|
--failed-only | false | keep only failing test cases |
jenkins-cli config
Set up and inspect configuration and contexts
jenkins-cli config
jenkins-cli config delete-context
Delete a context and its stored credential
jenkins-cli config delete-context <name>
Delete a context from the config file, together with its stored credential. The credential is kept when another context on the same server and authentication scheme still uses it. When the deleted context was current, the first remaining context becomes current. The only context cannot be deleted.
Examples
jenkins-cli config delete-context staging
jenkins-cli config get-contexts
List configured contexts and which one is current
jenkins-cli config get-contexts
Examples
jenkins-cli config get-contexts jenkins-cli config get-contexts --format table
jenkins-cli config init
Interactively configure a context and store credentials
jenkins-cli config init [flags]
Collects a server URL, username and API token (or password), verifies them, then writes a named context plus the secret. With --pretty it runs an interactive TUI (requires a terminal); without it, a plain line-by-line wizard that also works over a pipe. When a configuration already exists, it first asks whether to edit a context, add a new one, or replace it all (skip the question with --context <name>). For fully headless setup, set JENKINS_URL / JENKINS_USER / JENKINS_TOKEN (or JENKINS_PASSWORD) instead.
Options
| Flag | Default | Description |
|---|---|---|
--context | default | name for the context to create or update (skips the edit/add/replace prompt) |
Examples
jenkins-cli config init --pretty # interactive TUI (recommended) jenkins-cli config init # plain line-by-line wizard (scripts, non-TTY) jenkins-cli config init --context prod # add/update a named context directly
jenkins-cli config set-context
Configure service presets without credentials or network access
jenkins-cli config set-context <name> [flags]
Write service fields from flags, environment or .env over the named target context. Personal environment fields and secrets are ignored. Existing conflicting fields require --overwrite; unrelated contexts and user identities are preserved.
Options
| Flag | Default | Description |
|---|---|---|
--activate | false | make this the current context |
--dry-run | false | preview configuration changes without writing files or credentials |
--overwrite | false | update conflicting service fields; preserve personal identity and credentials |
Examples
jenkins-cli config set-context team --base-url https://service.example.com --dry-run jenkins-cli config set-context team --base-url https://service.example.com --activate
jenkins-cli config show
Show the resolved configuration with field provenance
jenkins-cli config show
jenkins-cli config use-context
Set the current context
jenkins-cli config use-context <name>
jenkins-cli doctor
Check configuration, credentials and connectivity
jenkins-cli doctor [flags]
Runs a quick health check: is a server configured, are credentials present, and can the server be reached and authenticated. Each check reports ok/failed so an agent can self-diagnose environment problems. It also reports whether a newer jenkins-cli release is available.
Options
| Flag | Default | Description |
|---|---|---|
--no-update-check | false | skip the check for a newer jenkins-cli release |
Examples
jenkins-cli doctor jenkins-cli doctor --no-update-check
jenkins-cli job
Discover jobs and trigger builds
jenkins-cli job
Jobs are the projects, folders and multibranch pipelines on the instance. `job list` is the discovery map; `job get` shows one job's detail (parameters, health, branch jobs, last-build pointers); `job build` triggers a build. Job paths are folder/job[/branch] — list to find the exact name before querying.
jenkins-cli job build
Trigger a build of a job (write)
jenkins-cli job build <path> [flags]
Starts a build of the job at <path>. Pass --param KEY=VALUE (repeatable) for a parameterized job. With --dry-run, print the request that would be sent and exit without triggering. This is a write: it is blocked in read-only mode unless --allow-writes is given.
Options
| Flag | Default | Description |
|---|---|---|
--dry-run | false | print the request without triggering the build |
--param | [] | build parameter KEY=VALUE (repeatable) |
Examples
jenkins-cli job build my-folder/my-app jenkins-cli job build my-app --param BRANCH=main --param CLEAN=true jenkins-cli job build my-app --param BRANCH=main --dry-run
jenkins-cli job get
Get one job, including parameters and last-build pointers
jenkins-cli job get <path>
Returns a single job by path (folder/job[/branch]): its description, build parameters, health, last / lastSuccessful / lastFailed build pointers, and — for folders and multibranch projects — the child jobs (branches and PRs).
jenkins-cli job list
List jobs (the discovery map)
jenkins-cli job list [flags]
Lists jobs with their type, status and last-build snapshot. Pass --folder to list inside a folder — or a multibranch project, which lists its branch / PR jobs — and --depth to recurse nested containers. Each job's last_build carries its result, start time and duration, so one call shows every branch's build situation. Status is derived from Jenkins' color field (success / failure / unstable / building / disabled / not_built).
Options
| Flag | Default | Description |
|---|---|---|
--depth | 0 | recurse nested folders this many levels (0 = immediate children) |
--folder | list jobs inside this folder, or branches of this multibranch project |
jenkins-cli queue
Inspect and manage the build queue
jenkins-cli queue
The queue holds builds waiting to start. List it to see what is pending or blocked and why, inspect one item, or cancel a queued build before it runs.
jenkins-cli queue cancel
Cancel a queued build before it starts (write)
jenkins-cli queue cancel <id> [flags]
Removes a still-queued build by its queue id. With --dry-run, print the request that would be sent and exit. This is a write: it is blocked in read-only mode unless --allow-writes is given.
Options
| Flag | Default | Description |
|---|---|---|
--dry-run | false | print the request without cancelling |
jenkins-cli queue get
Get one queue item
jenkins-cli queue get <id>
Returns a queue item's waiting reason, cancellation state, and assigned build under executable (number and URL) once it starts. Use that number with build get or build log; do not substitute the job's latest build. A missing executable means no build assignment is available yet; a 404 does not prove that the item started or was cancelled.
jenkins-cli queue list
List builds waiting in the queue
jenkins-cli queue list
jenkins-cli skill
Install the companion Skill for coding agents
jenkins-cli skill
jenkins-cli skill install
Deploy the embedded Skill into a coding agent's skills directory
jenkins-cli skill install [flags]
Write the companion `jenkins` Skill — bundled inside this binary — into a coding agent's skills directory. With no flags it probes for installed agents (claude-code, codex, cursor, agents, gemini, github-copilot, opencode, continue, windsurf, grok, pi, kilo, roo) and installs into each one found. Re-run it after upgrading the CLI to refresh the Skill to the matching version, then reload the agent context.
Options
| Flag | Default | Description |
|---|---|---|
--agent | [] | target agents instead of auto-detecting (claude-code, codex, cursor, agents, gemini, github-copilot, opencode, continue, windsurf, grok, pi, kilo, roo) |
--dir | explicit skills base directory; installs into <dir>/jenkins | |
--project | false | install into each agent's project skills directory instead of $HOME |
jenkins-cli skill path
Print Skill paths, installation state and version alignment
jenkins-cli skill path [flags]
Options
| Flag | Default | Description |
|---|---|---|
--agent | [] | limit to specific agents (claude-code, codex, cursor, agents, gemini, github-copilot, opencode, continue, windsurf, grok, pi, kilo, roo) |
--dir | explicit skills base directory | |
--project | false | use the project skills directories instead of $HOME |
jenkins-cli skill show
Print the embedded SKILL.md to stdout
jenkins-cli skill show
jenkins-cli skill status
Report loaded, installed and embedded Skill versions
jenkins-cli skill status [flags]
Options
| Flag | Default | Description |
|---|---|---|
--project | false | check each agent's project skills directory instead of $HOME |
jenkins-cli skill uninstall
Remove the companion Skill from a coding agent's skills directory
jenkins-cli skill uninstall [flags]
Delete a previously installed `jenkins` Skill. With no flags it probes for installed agents (claude-code, codex, cursor, agents, gemini, github-copilot, opencode, continue, windsurf, grok, pi, kilo, roo) and removes the Skill from each one found.
Options
| Flag | Default | Description |
|---|---|---|
--agent | [] | target agents instead of auto-detecting (claude-code, codex, cursor, agents, gemini, github-copilot, opencode, continue, windsurf, grok, pi, kilo, roo) |
--dir | explicit skills base directory; removes <dir>/jenkins | |
--project | false | remove from each agent's project skills directory instead of $HOME |
jenkins-cli version
Print version information
jenkins-cli version