需先在 $HOME 下创建 .jenkins.toml 并填好服务地址、用户名和 API Token,否则无法使用;默认关闭 TLS 证书校验,连接公网 Jenkins 时需留意安全风险;GitHub 不可访问时可改用 EdgeOne 镜像安装脚本,或通过 cargo install jenkins 安装
jenkins-cli
kairyouMIT活跃维护用 Rust 写的跨平台命令行工具,不用打开网页就能直接触发 Jenkins 构建,适合把 CI 流程塞进脚本或终端里。
Cross-platform CLI tool for triggering Jenkins builds. Written in Rust for high performance.
bash <(curl -fsSL https://raw.githubusercontent.com/kairyou/jenkins-cli/main/scripts/install.sh)README 未说明;仅需能运行 Rust 编译产物的 Mac、Windows 或 Linux 环境,无 GPU 或显存要求
用 Rust 写的跨平台 Jenkins 构建触发 CLI,交互式选项目、带参数触发并实时看日志
用 Rust 写的跨平台命令行工具,不用打开网页就能直接触发 Jenkins 构建,适合把 CI 流程塞进脚本或终端里。
核心能力
- 交互式选择 Jenkins 服务、项目与参数后触发构建
- 实时输出控制台日志,Ctrl+C 可回退或取消
- 记住上次构建参数,并支持为每个 Job 保存多套参数预设
- 支持多 Jenkins 服务配置与 includes/excludes 项目过滤
- 可选跟踪当前构建触发的下游构建
容易踩的坑
- v0.1.34最新正式版2026-10-27 · 2026-10-27 08:31 UTC
Security
Update Tokio from 1.53.1 to 1.53.3 to address RUSTSEC-2026-0386 (I/O safety in AsyncFd constructors). Fixes #31; included in commit 705602198330009d6504e3741e279e26048eca10.
What's Changed
- ci: update Node.js for EdgeOne deployment by @kairyou in https://github.com/kairyou/jenkins-cli/pull/30
- chore: release v0.1.34 by @kairyou in https://github.com/kairyou/jenkins-cli/pull/32
Full Changelog: https://github.com/kairyou/jenkins-cli/compare/v0.1.33...v0.1.34
- v0.1.332026-10-21 · 2026-10-21 06:19 UTC
查看更新说明
What's Changed
- fix(deps): resolve security advisories and replace YAML parser by @kairyou in https://github.com/kairyou/jenkins-cli/pull/28
- chore: release v0.1.33 by @kairyou in https://github.com/kairyou/jenkins-cli/pull/29
Full Changelog: https://github.com/kairyou/jenkins-cli/compare/v0.1.32...v0.1.33
- v0.1.322026-08-28 · 2026-08-28 11:32 UTC
查看更新说明
What's Changed
- ci: automate release PR and crates.io publishing by @kairyou in https://github.com/kairyou/jenkins-cli/pull/13
- fix(ci): make release uploads idempotent by @kairyou in https://github.com/kairyou/jenkins-cli/pull/14
- fix(ci): set repository context for release commands by @kairyou in https://github.com/kairyou/jenkins-cli/pull/15
- ci: require a dedicated token for release pull requests by @kairyou in https://github.com/kairyou/jenkins-cli/pull/16
- docs: replace star history charts with Shields badges by @kairyou in https://github.com/kairyou/jenkins-cli/pull/17
- chore: release v0.1.32 by @kairyou in https://github.com/kairyou/jenkins-cli/pull/18
Full Changelog: https://github.com/kairyou/jenkins-cli/compare/v0.1.31...v0.1.32
- v0.1.312026-08-26 · 2026-08-26 04:05 UTC
查看更新说明
What's Changed
- chore: upgrade dependencies and GitHub Actions by @kairyou in https://github.com/kairyou/jenkins-cli/pull/9
- test: harden TOML compatibility and release workflow by @kairyou in https://github.com/kairyou/jenkins-cli/pull/10
- chore: release v0.1.31 by @kairyou in https://github.com/kairyou/jenkins-cli/pull/11
Full Changelog: https://github.com/kairyou/jenkins-cli/compare/v0.1.30...v0.1.31
- v0.1.302026-08-25 · 2026-08-25 07:51 UTC
查看更新说明
Full Changelog: https://github.com/kairyou/jenkins-cli/compare/v0.1.29...v0.1.30
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
jenkins-cli
Cross-platform CLI tool for triggering Jenkins builds. Written in Rust for high performance.
Features
- Fast and efficient Jenkins job deployment
- Intuitive command-line interface with real-time console output
- Support for multiple Jenkins services, project filtering
- Common Jenkins operations support (e.g., triggering builds)
- High performance and cross-platform compatibility (Mac, Windows, Linux)
- Remembers last build parameters for quick re-runs
- Supports parameter presets for saving multiple reusable parameter sets per Job
- Optionally follows downstream builds triggered by the current build
Demo

Installation
To install the Jenkins CLI tool, use one of the following methods:
bash <(curl -fsSL https://raw.githubusercontent.com/kairyou/jenkins-cli/main/scripts/install.sh)
Or use EdgeOne mirror (if GitHub is inaccessible)
bash <(curl -fsSL https://jenkins-cli.xhl.io/scripts/install.sh)
If you have Rust and Cargo installed, you can install Jenkins CLI directly from crates.io:
cargo install jenkins
Alternatively, you can download the binary file from the Releases page.
TLS certificate verification is disabled by default for compatibility with internal Jenkins deployments that use self-signed certificates.
Usage
After setting up the configuration file (see Configuration section), you can simply run:
jenkins
This command will:
- Prompt you to select a Jenkins service (if multiple are configured)
- Display a list of available projects
- Select a project, then choose a parameter preset, last build parameters, or re-enter parameters
- Trigger the build and show real-time console output
Ctrl+C behavior:
- During selection: go back to the previous step
- During queue/build: confirm whether to cancel
- Press twice quickly: force exit
You can also use command line arguments:
# Run with Jenkins project URL - Deploy project directly without selection
jenkins -U http://jenkins.example.com:8081/job/My-Job/ -u username -t api_token
# Run with Jenkins server URL - Show project list for selection and deploy
jenkins -U http://jenkins.example.com:8081 -u username -t api_token
# Run with Jenkins auth cookie (e.g. jwt_token) - Use only when API token is not accepted
jenkins -U http://jenkins.example.com:8081 --cookie "jwt_token=your-jwt"
# Run a specific job with a saved parameter preset
jenkins -U http://jenkins.example.com:8081/job/My-Job/ --preset your-preset-name
Available command line options:
-U, --url <URL>: Jenkins server URL or project URL-u, --user <USER>: Jenkins username-t, --token <TOKEN>: Jenkins API token-c, --cookie <COOKIE>: Jenkins auth cookie (e.g. jwt_token=...)--preset <PRESET>: Use a saved parameter preset for the specified Jenkins job URL
Parameter presets can be saved from the CLI for common build parameter sets. history still automatically records the most recent actual build parameters for each Job.
Runtime data is stored in:
~/.jenkins-cli/history.toml # automatically recorded last build parameters
~/.jenkins-cli/presets.toml # user-saved parameter presets
Configuration
Create a file named .jenkins.toml in your home directory with the following content:
# $HOME/.jenkins.toml
[config]
# locale = "en-US" # (optional), default auto detect, e.g. zh-CN, en-US
# enable_history = false # (optional), default true
# check_update = false # (optional), default true
# timeout = 30 # (optional), HTTP request timeout in seconds, default 30
# follow_downstream = false # (optional), default false, follow downstream builds triggered by the current build
[[jenkins]]
name = "SIT"
url = "https://jenkins-sit.example.com"
user = "your-username"
token = "your-api-token"
# includes = []
# excludes = []
# [[jenkins]]
# name = "PROD"
# url = "https://jenkins-prod.example.com"
# user = "your-username"
# token = "your-api-token"
# includes = ["frontend", "backend"]
# excludes = ["test"]
Configuration Options
config: Global configuration sectionlocale: Set language (optional), default auto detect, e.g. "zh-CN", "en-US"enable_history: Remember last build parameters (optional), default true, set to false to disablecheck_update: Automatically check for updates (optional), default true, set to false to disabletimeout: HTTP request timeout in seconds (optional), default 30follow_downstream: Follow downstream builds triggered by the current build (optional), default false
jenkins: Service configuration section (supports multiple services)name: Service name (e.g., "SIT", "UAT", "PROD")url: Jenkins server URLuser: Your Jenkins user IDtoken: Your Jenkins API tokenincludes: List of strings or regex patterns to include projects (optional)excludes: List of strings or regex patterns to exclude projects (optional)enable_history: Remember build parameters (optional), overrides global setting if specifiedcookie: Optional, Jenkins auth cookie (e.g. jwt_token=...). Sends a Cookie header when set.cookie_refresh: Optional, cookie auto-update configuration (updates thecookievalue)url: Refresh endpoint URLmethod: HTTP method, default "POST"request: Optional, request parameters (replaces${cookie.<name>}placeholders with values from thecookiefield):headers: Optional, extra request headers (for exampleX-Client-Id = "your-client-id")query: URL query parametersform: x-www-form-urlencoded body parametersjson: JSON body payload (supports string/number/boolean/object/array)
cookie_updates: Optional, cookie updates extracted from the response (written back to thecookiefield):body.json:<path>: JSON body path, e.g.body.json:data.refreshTokenheader:<name>: Response header name, e.g.header:X-JWT-Tokenbody.regex:<pattern>: Regex against response body, use capture group 1, e.g.body.regex:token=([\\w.-]+)
Cookie Authentication (Optional)
Most users should use user + token. Cookie auth is an optional fallback for setups that do not accept API tokens.
Note: If you have an extra endpoint to refresh cookie values, configure cookie_refresh to call it and write back to cookie; otherwise you can ignore cookie_refresh.
[[jenkins]]
name = "Cookie-Refresh"
url = "https://jenkins.example.com"
cookie = "jwt_token=your-jwt"
[jenkins.cookie_refresh]
url = "https://auth.example.com/api/refresh-token"
method = "POST"
# Pick one request style:
# request.query = { refreshToken = "${cookie.jwt_token}" } # send via query params
request.json = { refreshToken = "${cookie.jwt_token}" } # send via JSON body
cookie_updates = { jwt_token = "body.json:data.refreshToken" }
Login API example (token returned in JSON body):
[[jenkins]]
name = "Login-Refresh"
url = "https://jenkins.example.com"
[jenkins.cookie_refresh]
url = "https://auth.example.com/api/auth/login"
method = "POST"
# Optional custom headers:
# request.headers = { X-Client-Id = "your-client-id" }
request.json = { username = "your-username", password = "your-encrypted-password", remember = true }
cookie_updates = { jwt_token = "body.json:data.token" }
Project Filtering
You can use includes or excludes to filter projects:
includes: ["frontend", "backend", "^api-"]# Include projects containing [frontend, backend, api-]excludes: ["test", "dev", ".*-deprecated$"]# Exclude projects containing [test, dev, *-deprecated]
Note: Regex patterns are case-sensitive unless specified otherwise (e.g., (?i) for case-insensitive matching).
Username and API Token
Your Jenkins username is typically the same as your login username for the Jenkins web interface.
To generate an API token:
- Log in to your Jenkins server
- Click on your name in the top right corner
- Click on
Configurein the left sidebar - In the
API Tokensection, clickAdd new Token - Give your token a name and click "Generate"
- Copy the generated token and paste it into your
.jenkins.tomlfile
Note: Keep your API token secure. Do not share it or commit it to version control.
TODOs
- Support multiple Jenkins services
- Support string and text parameter types
- Support choice parameter type
- Support boolean parameter type
- Support password parameter type
- Auto-detect current directory's git branch
- Remember last selected project and build parameters
- Save Job parameter presets
- Follow downstream Jenkins builds
- i18n support (fluent)
- Automatically check for updates
License
This project is licensed under the MIT License - see the LICENSE file for details.