- Quick Start (Installation from Binary)
- Manual Compilation
- Features
- Usage
- Commands
- Contributing
- License
Download the binary for your platform:
# for x86-64
wget -O jns-0.1.1-amd64 https://github.com/mirum8/jnscli/releases/download/v0.1.1/jns-0.1.1-amd64 \
&& chmod +x jns-0.1.1-amd64 && mkdir -p $HOME/.local/bin/ \
&& mv jns-0.1.1-amd64 $HOME/.local/bin/jns
# for ARM (Apple M1)
wget -O jns-0.1.1-arm64 https://github.com/mirum8/jnscli/releases/download/v0.1.1/jns-0.1.1-arm64 \
&& chmod +x jns-0.1.1-arm64 && mkdir -p $HOME/.local/bin/ \
&& mv jns-0.1.1-arm64 $HOME/.local/bin/jns
Add the binary to your PATH:
# for bash
echo "export PATH=\$PATH:$HOME/.local/bin/" >> $HOME/.bashrc && source $HOME/.bashrc
# for zsh
echo "export PATH=\$PATH:$HOME/.local/bin/" >> $HOME/.zshrc && source $HOME/.zshrc
Connect to your Jenkins server. You will be prompted to enter the server URL, username, and token:
jns connect
List Jenkins jobs:
jns list
Run a job:
jns build <jobName>
- GraalVM JDK 21
git clone https://github.com/mirum8/jnscli.git \
&& cd jnscli \
&& ./mvnw clean native:compile -Pnative \
&& mkdir -p $HOME/.local/bin/ \
&& mv target/jns $HOME/.local/bin/jns
Add the binary to your PATH:
# for bash
echo "export PATH=\$PATH:$HOME/.local/bin/" >> $HOME/.bashrc && source $HOME/.bashrc
# for zsh
echo "export PATH=\$PATH:$HOME/.local/bin/" >> $HOME/.zshrc && source $HOME/.zshrc
- Get a list of jobs
- Build a job with parameters
- Get information about a job and its builds
- Abort a running job
- Manage job aliases
- Retrieve and analyze build errors
- AI-powered error analysis
Start the CLI application and use the available commands to interact with your Jenkins server.
List all jobs on the Jenkins server:
jns list
List jobs in a specific folder:
jns list <folder>
Run a job on the Jenkins server:
jns build <jobId|jobName> [-p, --params <key=value>...] [-q, --quiet] [-l, --log] [--ai]
You can also use an ID number (prefixed by '%') from the 'list' output to start a job:
If the job already started, you can abort the previous build and start a new one (or cancel the new build):
Options:
-
-q, --quiet
: Run the job in quiet mode, suppressing the progress bar. -
-l, --log
: Display the build log during running job. -
-p, --params <key=value>
: Specify build parameters. If you don't specify required parameters, you will be prompted to enter them. To pass multiple parameters, use this flag multiple times. For example:jns build <jobId> \ -p key1=value1 \ -p key2=value2
-
--ai
: Analyze errors using AI if the build fails.
Abort a running job:
jns abort <jobId> [--b, --buildNumber]
Connect to the Jenkins server:
jns connect
Manage job aliases:
jns alias add <aliasName> <jobIdOrUrl> # Add an alias
jns alias rm <aliasName> # Remove an alias
jns alias ls # List all aliases
Get information about a job:
jns info <jobId> [options]
Options:
-b, --buildNumber
: Specify build number-s, --includeSuccess
: Include successful builds-f, --includeFailed
: Include failed builds-r, --includeRunning
: Include running builds-l, --limit
: Limit the number of builds (default: 3)-m, --my-builds
: Show builds run by the current user
Get error information for the last or a specific build:
jns error <jobId> [Options]
Options:
-b, --buildNumber
: Specify build number-m, --myBuild
: Show error for the last build run by the current user--ai
: Analyze errors with AI
If parameters are not specified, the command will return the error information for the last failed build within the last 5 builds.
AI-powered error analysis is available for Jenkins builds. To use this feature, you need to configure the AI settings ( Ollama and OpenAI are supported as AI services):
jns ai configure
After configuring the AI settings, you can test the AI service availability:
jns ai test
Now you can use --ai
parameter in the 'build' and 'error' commands to analyze build errors with AI.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License.