A powerful and efficient Jenkins CLI tool written in Rust. Simplifies deployment of Jenkins jobs with an intuitive command-line experience.
- Rapid deployment of Jenkins jobs
- Intuitive command-line interface
- Support for multiple Jenkins environments
- Project filtering capabilities
- Support for common Jenkins operations (e.g., triggering builds)
- Real-time console output during job execution
- High performance, guaranteed by Rust language
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://ghp.ci/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:
- Prompt you to select an environment (if multiple are configured)
- Display a list of available projects
- Select a project and set build parameters
- Trigger the build and show real-time console output
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
[[jenkins]]
name = "SIT"
url = "https://jenkins-sit.your-company.com"
user = "your-username"
token = "your-api-token"
# includes = []
# excludes = []
# [[jenkins]]
# name = "PROD"
# url = "https://jenkins-prod.your-company.com"
# user = "your-username"
# token = "your-api-token"
# includes = ["frontend", "backend"]
# excludes = ["test"]
config
: Global configuration sectionlocale
: Set language (optional), default auto detect, e.g. "zh-CN", "en-US"
jenkins
: Environment configuration section (supports multiple environments)name
: Environment 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)
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:
- Log in to your Jenkins server
- Click on your name in the top right corner
- Click on "Configure" in the left sidebar
- In the API Token section, click "Add new Token"
- Give your token a name and click "Generate"
- Copy the generated token and paste it into your
.jenkins.toml
file
Note: Keep your API token secure. Do not share it or commit it to version control.
- Support multiple Jenkins environments
- 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
- i18n support (fluent)
- Auto-upgrade feature (self_update)
This project is licensed under the MIT License - see the LICENSE file for details.