| Crates.io | jenkins |
| lib.rs | jenkins |
| version | 0.1.21 |
| created_at | 2024-09-18 15:50:17.178972+00 |
| updated_at | 2025-12-25 11:03:36.643417+00 |
| description | A CLI tool for triggering Jenkins builds and monitoring job status |
| homepage | |
| repository | https://github.com/kairyou/jenkins-cli |
| max_upload_size | |
| id | 1379387 |
| size | 760,043 |
Cross-platform CLI tool for triggering Jenkins builds. Written in Rust for high performance.

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 ghp.ci mirror (if GitHub is inaccessible)
bash <(curl -fsSL https://ghfast.top/raw.githubusercontent.com/kairyou/jenkins-cli/main/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.
After setting up the configuration file (see Configuration section), you can simply run:
jenkins
This command will:
Ctrl+C behavior:
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) - Useful when API token is not accepted
jenkins -U http://jenkins.example.com:8081 --cookie "jwt_token=your-jwt"
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=...)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
[[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"]
config: Global configuration section
locale: 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 30jenkins: 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=...). Use only if API tokens are not accepted.cookie_refresh: Optional, cookie auto-update configuration (updates the cookie value)
url: Refresh endpoint URLmethod: HTTP method, default "POST"request: Optional, request parameters (replaces ${cookie.<name>} placeholders with values from the cookie field):
query: URL query parametersform: x-www-form-urlencoded body parametersjson: JSON body parameterscookie_updates: Optional, cookie updates extracted from the response (written back to the cookie field):
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.-]+)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 = "Query-Refresh"
url = "https://jenkins-query.example.com"
cookie = "jwt_token=initial"
[jenkins.cookie_refresh]
url = "https://auth.example.com/api/refresh-token"
method = "POST"
request = { query = { refreshToken = "${cookie.jwt_token}" } }
cookie_updates = { jwt_token = "body.json:data.refreshToken" }
[[jenkins]]
name = "JSON-Refresh"
url = "https://jenkins-json.example.com"
cookie = "jwt_token=initial"
[jenkins.cookie_refresh]
url = "https://auth.example.com/api/refresh-token"
method = "POST"
request = { json = { refreshToken = "${cookie.jwt_token}" } }
cookie_updates = { jwt_token = "body.json:data.refreshToken" }
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).
Your Jenkins username is typically the same as your login username for the Jenkins web interface.
To generate an API token:
Configure in the left sidebarAPI Token section, click Add new Token.jenkins.toml fileNote: Keep your API token secure. Do not share it or commit it to version control.
This project is licensed under the MIT License - see the LICENSE file for details.