重要前提
安装AI Skills的关键前提是:必须科学上网,且开启TUN模式,这一点至关重要,直接决定安装能否顺利完成,在此郑重提醒三遍:科学上网,科学上网,科学上网。查看完整安装教程 →
npx skills add https://github.com/avivsinai/jenkins-cli --skill jkjk 是一个 Jenkins 控制器 的 GitHub CLI 风格接口。它为开发者和运维人员提供了现代化、可脚本化的工作流。
在执行任何 jk 命令之前,请验证 CLI 是否已安装:
jk --version
如果命令失败或未找到 jk,请使用以下方法之一进行安装:
| 平台 | 命令 |
|---|---|
| macOS/Linux | brew install avivsinai/tap/jk |
| Windows | scoop bucket add avivsinai https://github.com/avivsinai/scoop-bucket && scoop install jk |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| Go | go install github.com/avivsinai/jenkins-cli/cmd/jk@latest |
| 二进制文件 | 从 GitHub Releases 下载 |
只有在确认安装成功后,才能继续执行 jk 命令。
# 使用凭据登录
jk auth login https://jenkins.example.com --username alice --token <API_TOKEN>
# 使用自定义上下文名称登录
jk auth login https://jenkins.example.com --name prod --username alice --token <TOKEN>
# 使用 TLS 选项登录
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
# 检查身份验证状态(活动上下文)
jk auth status
# 从上下文登出
jk auth logout # 从活动上下文登出
jk auth logout prod # 从特定上下文登出
auth login 的选项:
--name — 上下文名称(默认为主机名)--username — Jenkins 用户名--token — API 令牌--insecure — 跳过 TLS 验证--proxy — 代理 URL--ca-file — 自定义 CA 证书包--set-active — 设置为活动上下文(默认:true)--allow-insecure-store — 允许加密文件回退上下文存储控制器 URL 和凭据,便于切换:
# 列出上下文(* = 活动)
jk context ls
# 切换活动上下文
jk context use prod-jenkins
# 移除上下文
jk context rm staging
环境变量:JK_CONTEXT 可覆盖活动上下文。
| 任务 | 命令 |
|---|---|
| 搜索任务 | jk search --job-glob '*deploy*' |
| 列出任务 | jk job ls |
| 查看任务 | jk job view team/app |
| 列出运行 | jk run ls team/app |
| 启动运行 | jk run start team/app -p KEY=value |
| 查看运行 | jk run view team/app 128 |
| 跟随日志 | jk run start team/app --follow |
| 流式日志 | jk log team/app 128 --follow |
| 下载制品 | jk artifact download team/app 128 |
| 测试报告 | jk test report team/app 128 |
| 列出凭据 | jk cred ls |
| 列出节点 | jk node ls |
| 查看队列 | jk queue ls |
| 列出插件 | jk plugin ls |
# 跨文件夹搜索
jk search --job-glob '*deploy*' --limit 10
# 在特定文件夹中搜索
jk search --folder team/services --job-glob '*api*'
# 按运行结果过滤
jk search --job-glob '*' --filter result=FAILURE --since 7d
# 使用参数过滤器
jk search --job-glob '*/deploy-*' --filter param.ENV=production
# 列出根目录下的任务
jk job ls
# 列出文件夹中的任务(位置参数或标志)
jk job ls team/app
jk job ls --folder team/app
# 查看任务详情
jk job view team/app/pipeline
# 列出最近的运行
jk run ls team/app/pipeline
# 限制结果数量
jk run ls team/app/pipeline --limit 50
# 过滤运行
jk run ls team/app/pipeline --filter result=SUCCESS
jk run ls team/app/pipeline --filter result=FAILURE --since 7d
# 按参数过滤
jk run ls team/app/pipeline --filter param.ENV=staging
# 包含队列中的构建
jk run ls team/app/pipeline --include-queued
# 按参数分组
jk run ls team/app/pipeline --group-by param.ENV --agg last
# 包含代理的元数据
jk run ls team/app/pipeline --json --with-meta
# 分页
jk run ls team/app/pipeline --cursor <cursor-from-previous>
# 启动一个运行
jk run start team/app/pipeline
# 使用参数启动
jk run start team/app/pipeline -p BRANCH=main -p ENV=staging
# 启动并跟随日志
jk run start team/app/pipeline --follow
# 启动并等待完成(不流式传输日志)
jk run start team/app/pipeline --wait --timeout 10m
# 仅获取结果
jk run start team/app/pipeline --follow --result
# 模糊匹配任务
jk run start deploy --fuzzy
# 查看运行详情
jk run view team/app/pipeline 128
# 仅获取结果状态
jk run view team/app/pipeline 128 --result
# 使用构建结果代码退出
jk run view team/app/pipeline 128 --exit-status
# 等待完成
jk run view team/app/pipeline 128 --wait --timeout 5m
# 显示摘要
jk run view team/app/pipeline 128 --summary
# 查看运行参数
jk run params team/app/pipeline
# 取消运行
jk run cancel team/app/pipeline 128
jk run cancel team/app/pipeline 128 --mode term
jk run cancel team/app/pipeline 128 --mode kill
# 重新运行构建(使用相同参数)
jk run rerun team/app/pipeline 128
jk run rerun team/app/pipeline 128 --follow
# 查看控制台日志(快照)
jk log team/app/pipeline 128
# 流式传输实时日志
jk log team/app/pipeline 128 --follow
# 自定义轮询间隔
jk log team/app/pipeline 128 --follow --interval 2s
# 纯文本输出(无装饰)
jk log team/app/pipeline 128 --plain
# 列出制品
jk artifact ls team/app/pipeline 128
# 下载所有制品
jk artifact download team/app/pipeline 128
# 使用模式过滤器下载
jk artifact download team/app/pipeline 128 --pattern "**/*.jar"
jk artifact download team/app/pipeline 128 -p "reports/**/*.xml"
# 输出目录
jk artifact download team/app/pipeline 128 -o ./artifacts/
# 允许空结果(无匹配时不报错)
jk artifact download team/app/pipeline 128 -p "*.log" --allow-empty
# 查看测试报告
jk test report team/app/pipeline 128
# JSON 输出
jk test report team/app/pipeline 128 --json
# 列出凭据(系统范围)
jk cred ls
# 列出文件夹范围的凭据
jk cred ls --scope folder --folder team/app
# 创建秘密文本
jk cred create-secret --id my-secret --secret "value"
jk cred create-secret --id my-secret --secret "value" --description "API key"
# 从标准输入创建
echo "secret-value" | jk cred create-secret --id my-secret --from-stdin
# 文件夹范围的凭据
jk cred create-secret --id my-secret --secret "value" --scope folder --folder team/app
# 删除凭据(仅系统范围)
jk cred rm my-secret
# 列出节点
jk node ls
# 封锁节点(标记为临时离线)
jk node cordon agent-01
jk node cordon agent-01 --message "Maintenance"
# 解除封锁节点(恢复在线)
jk node uncordon agent-01
# 移除节点
jk node rm agent-01
# 列出队列中的项目
jk queue ls
# 取消队列中的项目
jk queue cancel <item-id>
# 列出已安装的插件
jk plugin ls
# 安装插件(提示确认)
jk plugin install docker-workflow
# 无需确认安装
jk plugin install docker-workflow --yes
# 安装特定版本
jk plugin install docker-workflow@1.26
# 启用/禁用插件
jk plugin enable docker-workflow
jk plugin disable docker-workflow
所有命令都支持结构化输出:
# JSON 输出
jk run ls team/app --json
# YAML 输出
jk run ls team/app --yaml
# 使用 jq 表达式过滤
jk run ls team/app --json --jq '.items[0].number'
# Go 模板
jk run ls team/app --json --template '{{range .items}}{{.number}}{{end}}'
# 静默模式(最小化输出)
jk run start team/app --quiet
-c, --context <name> — 使用特定上下文--json — JSON 输出--yaml — YAML 输出--format json|yaml — 输出格式--jq <expr> — 使用 jq 表达式过滤 JSON-t, --template <tmpl> — 使用 Go 模板格式化-q, --quiet — 抑制非必要输出JK_CONTEXT — 覆盖活动上下文JK_QUIET — 等同于 --quiet(任何值都会启用)| 代码 | 含义 |
|---|---|
| 0 | 成功 |
| 1 | 一般错误 |
| 2 | 验证错误 |
| 3 | 未找到 |
| 4 | 身份验证失败 |
| 5 | 权限被拒绝 |
| 6 | 连接失败 |
| 7 | 超时 |
| 8 | 功能不支持 |
使用 --follow 或 --wait 时,构建结果使用额外的代码:
| 代码 | 结果 |
|---|---|
| 0 | 成功 |
| 10 | 不稳定 |
| 11 | 失败 |
| 12 | 已中止 |
| 13 | 未构建 |
| 14 | 运行中 |
每周安装
45
仓库
GitHub Stars
27
首次出现
2026年1月25日
安全审计
安装于
opencode39
cursor39
claude-code36
gemini-cli34
codex33
github-copilot30
jk is a GitHub CLI–style interface for Jenkins controllers. It provides modern, scriptable workflows for developers and operators.
Before executing anyjk command, verify the CLI is installed:
jk --version
If the command fails or jk is not found, install it using one of these methods:
| Platform | Command |
|---|---|
| macOS/Linux | brew install avivsinai/tap/jk |
| Windows | scoop bucket add avivsinai https://github.com/avivsinai/scoop-bucket && scoop install jk |
| Go | go install github.com/avivsinai/jenkins-cli/cmd/jk@latest |
| Binary | Download from GitHub Releases |
Only proceed withjk commands after confirming installation succeeds.
# 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 fallbackContexts 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.
| Task | Command |
|---|---|
| Search jobs | jk search --job-glob '*deploy*' |
| List jobs | jk job ls |
| View job | jk job view team/app |
| List runs | jk run ls team/app |
| Start run | jk run start team/app -p KEY=value |
| View run | jk run view team/app 128 |
# 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
# 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
# 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>
# 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
# 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
# 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/app/pipeline 128 --mode kill
# Rerun a build (with same parameters)
jk run rerun team/app/pipeline 128
jk run rerun team/app/pipeline 128 --follow
# View console log (snapshot)
jk log team/app/pipeline 128
# Stream live logs
jk log team/app/pipeline 128 --follow
# Custom poll interval
jk log team/app/pipeline 128 --follow --interval 2s
# Plain output (no decorations)
jk log team/app/pipeline 128 --plain
# List artifacts
jk artifact ls team/app/pipeline 128
# Download all artifacts
jk artifact download team/app/pipeline 128
# Download with pattern filter
jk artifact download team/app/pipeline 128 --pattern "**/*.jar"
jk artifact download team/app/pipeline 128 -p "reports/**/*.xml"
# Output directory
jk artifact download team/app/pipeline 128 -o ./artifacts/
# Allow empty result (no error if no matches)
jk artifact download team/app/pipeline 128 -p "*.log" --allow-empty
# View test report
jk test report team/app/pipeline 128
# JSON output
jk test report team/app/pipeline 128 --json
# List credentials (system scope)
jk cred ls
# List folder-scoped credentials
jk cred ls --scope folder --folder team/app
# Create secret text
jk cred create-secret --id my-secret --secret "value"
jk cred create-secret --id my-secret --secret "value" --description "API key"
# Create from stdin
echo "secret-value" | jk cred create-secret --id my-secret --from-stdin
# Folder-scoped credential
jk cred create-secret --id my-secret --secret "value" --scope folder --folder team/app
# Delete credential (system scope only)
jk cred rm my-secret
# List nodes
jk node ls
# Cordon node (mark temporarily offline)
jk node cordon agent-01
jk node cordon agent-01 --message "Maintenance"
# Uncordon node (bring back online)
jk node uncordon agent-01
# Remove node
jk node rm agent-01
# List queued items
jk queue ls
# Cancel queued item
jk queue cancel <item-id>
# List installed plugins
jk plugin ls
# Install plugin (prompts for confirmation)
jk plugin install docker-workflow
# Install without confirmation
jk plugin install docker-workflow --yes
# Install specific version
jk plugin install docker-workflow@1.26
# Enable/disable plugin
jk plugin enable docker-workflow
jk plugin disable docker-workflow
All commands support structured output:
# JSON output
jk run ls team/app --json
# YAML output
jk run ls team/app --yaml
# Filter with jq expression
jk run ls team/app --json --jq '.items[0].number'
# Go template
jk run ls team/app --json --template '{{range .items}}{{.number}}{{end}}'
# Quiet mode (minimal output)
jk run start team/app --quiet
-c, --context <name> — Use specific context--json — JSON output--yaml — YAML output--format json|yaml — Output format--jq <expr> — Filter JSON with jq expression-t, --template <tmpl> — Format with Go template-q, --quiet — Suppress non-essential outputJK_CONTEXT — Override active contextJK_QUIET — Equivalent to --quiet (any value enables)| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | General error |
| 2 | Validation error |
| 3 | Not found |
| 4 | Authentication failure |
| 5 | Permission denied |
| 6 | Connectivity failure |
| 7 | Timeout |
| 8 | Feature unsupported |
With --follow or --wait, build results use additional codes:
| Code | Result |
|---|---|
| 0 | SUCCESS |
| 10 | UNSTABLE |
| 11 | FAILURE |
| 12 | ABORTED |
| 13 | NOT_BUILT |
| 14 | RUNNING |
Weekly Installs
45
Repository
GitHub Stars
27
First Seen
Jan 25, 2026
Security Audits
Gen Agent Trust HubPassSocketFailSnykFail
Installed on
opencode39
cursor39
claude-code36
gemini-cli34
codex33
github-copilot30
Azure Data Explorer (Kusto) 查询技能:KQL数据分析、日志遥测与时间序列处理
145,500 周安装
跨越鸿沟框架:颠覆性技术产品从早期采用者到主流市场的营销策略指南
632 周安装
Airflow DAG编写指南:使用af CLI创建与验证DAG的最佳实践
559 周安装
Terraform 与 OpenTofu 最佳实践指南:模块架构、测试策略与 CI/CD
559 周安装
FFmpeg视频处理与编辑自动化教程:剪辑、转场、音频混音、批量处理与导出优化
559 周安装
nuqs Next.js 最佳实践:42条类型安全URL状态管理规则,提升开发效率与性能
564 周安装
iOS Vision Framework 计算机视觉开发指南:主体分割、姿态检测、OCR 与文档扫描
563 周安装
| Follow logs | jk run start team/app --follow |
| Stream logs | jk log team/app 128 --follow |
| Download artifacts | jk artifact download team/app 128 |
| Test report | jk test report team/app 128 |
| List credentials | jk cred ls |
| List nodes | jk node ls |
| View queue | jk queue ls |
| List plugins | jk plugin ls |