jenkins-cli

⚡ Usage

Scriptable command reference — the cheat sheet, non-interactive patterns, artifacts, and queue & pipeline info.

📋 Cheat Sheet

TaskCommandNotes
Latest build statusjenkins status jobAdd --pretty for coloured state + icon
List buildsjenkins list job -l 15Uses latest N builds
Stream logsjenkins logs job -fProgressive API polling
Static logs JSONjenkins logs job --jsonOutputs { text }
Trigger buildjenkins trigger jobPlain trigger (no params)
Param buildjenkins build job --param KEY=V --param X=YRepeat flag
Stop buildjenkins stop job 456Aborts running build
Artifacts listjenkins artifacts job 456Tab separated list
Download artifactsjenkins artifacts job 456 -o out/All artifacts
Filter artifactsjenkins artifacts job 456 -p .jarSimple substring
Test summaryjenkins test-report job 456Add --json for details
Pipeline stagesjenkins stages job 456Needs workflow-api plugin
Queue listjenkins queueItems with flags
Cancel queuejenkins queue-cancel 123Immediate POST
Search jobsjenkins search api -l 200BFS substring matching
Single-job TUIjenkins ui jobBuild list + logs
Multi-job TUIjenkins interactiveJobs + builds + logs

🤖 Non-Interactive Patterns

If you see an error like missing required argument 'jobOrUrl', it means the command expects a job name (or a full job/build URL) as the first positional argument.

Common patterns:

# Latest build status (pretty colors)
jenkins status my-service --pretty

# Follow live logs of latest (or specific) build
jenkins logs my-service -f
jenkins logs my-service 128 -f

# Plain console (same as logs without -f)
jenkins console my-service
jenkins console https://ci.example.com/job/my-service/128/

# List recent builds (limit 20)
jenkins list my-service -l 20

<jobOrUrl> accepts either:

  • A simple job name (folder paths use /, e.g. team/backend-api)
  • A full build URL (.../job/<name>/<build>/) or job URL (.../job/<name>/)

If the build number is omitted, the CLI resolves the latest build where supported.

Interactive exploration (jobs + builds + logs) still uses either:

jenkins --interactive            # root flag form
jenkins interactive              # explicit subcommand form

📦 Artifacts

# List artifacts of latest build (auto-resolves if number omitted)
jenkins artifacts my-job

# List artifacts for specific build
jenkins artifacts my-job 128

# Download all to directory (creates if missing)
jenkins artifacts my-job 128 -o dist/artifacts

# Filter by substring (.jar) BEFORE downloading
jenkins artifacts my-job 128 -p .jar -o jars/

🚦 Queue & Pipeline Info

jenkins queue                 # List queued tasks
jenkins queue-cancel 1234     # Cancel item
jenkins stages my-job 456     # Pipeline stages (needs workflow-api plugin)
jenkins test-report my-job 456 --json  # Full JUnit JSON structure

On this page