jk

from avivsinai/jenkins-cli

GitHub-style CLI for Jenkins — manage contexts, runs, logs, and admin tasks from your terminal.

17 stars2 forksUpdated Jan 26, 2026
npx skills add https://github.com/avivsinai/jenkins-cli --skill jk

SKILL.md

Jenkins CLI (jk)

jk is a GitHub CLI–style interface for Jenkins controllers. It provides modern, scriptable workflows for developers and operators.

Dependency Check

Before executing any jk command, verify the CLI is installed:

jk --version

If the command fails or jk is not found, install it using one of these methods:

PlatformCommand
macOS/Linuxbrew install avivsinai/tap/jk
Windowsscoop bucket add avivsinai https://github.com/avivsinai/scoop-bucket && scoop install jk
Gogo install github.com/avivsinai/jenkins-cli/cmd/jk@latest
BinaryDownload from GitHub Releases

Only proceed with jk commands after confirming installation succeeds.

Authentication

# Login with credentials
jk auth login https://jenkins.example.com --username alice --token <API_TOKEN>

# Login with custom context name
jk auth login https://jenkins.example.com --name prod --username alice --token <TOKEN>

# Login with TLS options
jk auth login https://jenkins.example.com --username alice --token <TOKEN> --insecure
jk auth login https://jenkins.example.com --username alice --token <TOKEN> --ca-file /path/to/ca.pem

# Check auth status (active context)
jk auth status

# Logout from a context
jk auth logout              # Logout from active context
jk auth logout prod         # Logout from specific context

Options for auth login:

  • --name — Context name (defaults to hostname)
  • --username — Jenkins username
  • --token — API token
  • --insecure — Skip TLS verification
  • --proxy — Proxy URL
  • --ca-file — Custom CA bundle
  • --set-active — Set as active context (default: true)
  • --allow-insecure-store — Allow encrypted file fallback

Contexts

Contexts store controller URLs and credentials for easy switching:

# List contexts (* = active)
jk context ls

# Switch active context
jk context use prod-jenkins

# Remove a context
jk context rm staging

Environment: JK_CONTEXT overrides active context.

Quick Command Reference

TaskCommand
Search jobsjk search --job-glob '*deploy*'
List jobsjk job ls
View jobjk job view team/app
List runsjk run ls team/app
Start runjk run start team/app -p KEY=value
View runjk run view team/app 128
Follow logsjk run start team/app --follow
Stream logsjk log team/app 128 --follow
Download artifactsjk artifact download team/app 128
Test reportjk test report team/app 128
List credentialsjk cred ls
List nodesjk node ls
View queuejk queue ls
List pluginsjk plugin ls

Job Discovery

# Search across folders
jk search --job-glob '*deploy*' --limit 10

# Search in specific folder
jk search --folder team/services --job-glob '*api*'

# Filter by run results
jk search --job-glob '*' --filter result=FAILURE --since 7d

# With parameter filters
jk search --job-glob '*/deploy-*' --filter param.ENV=production

Job Operations

# List jobs in root
jk job ls

# List jobs in folder (positional or flag)
jk job ls team/app
jk job ls --folder team/app

# View job details
jk job view team/app/pipeline

Run Management

Listing Runs

# List recent runs
jk run ls team/app/pipeline

# Limit results
jk run ls team/app/pipeline --limit 50

# Filter runs
jk run ls team/app/pipeline --filter result=SUCCESS
jk run ls team/app/pipeline --filter result=FAILURE --since 7d

# Filter by parameters
jk run ls team/app/pipeline --filter param.ENV=staging

# Include queued builds
jk run ls team/app/pipeline --include-queued

# Group by parameter
jk run ls team/app/pipeline --group-by param.ENV --agg last

# With metadata for agents
jk run ls team/app/pipeline --json --with-meta

# Pagination
jk run ls team/app/pipeline --cursor <cursor-from-previous>

Starting Runs

# Start a run
jk run start team/app/pipeline

# Start with parameters
jk run start team/app/pipeline -p BRANCH=main -p ENV=staging

# Start and follow logs
jk run start team/app/pipeline --follow

# Start, wait for completion (no log streaming)
jk run start team/app/pipeline --wait --timeout 10m

# Get only the result
jk run start team/app/pipeline --follow --result

# Fuzzy job matching
jk run start deploy --fuzzy

Viewing Runs

# View run details
jk run view team/app/pipeline 128

# Get only result status
jk run view team/app/pipeline 128 --result

# Exit with build result code
jk run view team/app/pipeline 128 --exit-status

# Wait for completion
jk run view team/app/pipeline 128 --wait --timeout 5m

# Show summary
jk run view team/app/pipeline 128 --summary

Other Run Commands

# View run parameters
jk run params team/app/pipeline

# Cancel a run
jk run cancel team/app/pipeline 128
jk run cancel team/app/pipeline 128 --mode term
jk run cancel team/ap

...
Read full content

Repository Stats

Stars17
Forks2
LicenseMIT License