Skip to main content

jenkinsctl

jenkinsctl PyPI version Downloads License: GPL v3

jenkinsctl – Jenkins Control Right from Your Terminal 🚀

jenkinsctl is a CLI tool that puts Jenkins management right in your terminal. It simplifies tasks like listing builds, fetching logs, and triggering parameterized jobs—no more web UI hassle!

Why jenkinsctl? 🔥

Jenkins workflows can be tedious through the web UI. jenkinsctl keeps your hands on the keyboard, streamlining Jenkins management directly from your terminal, making it perfect for quick job control, scripting, and automation.


Key Features

  • Quick Build Listings: View recent builds for any job.
  • Instant Log Access: Fetch build logs effortlessly.
  • JSON & YAML API Data: Retrieve job configurations and build data in JSON or YAML.
  • Easy Rebuilds: Re-run jobs without reopening Jenkins.
  • Parameterized Builds: Customize builds with dynamic parameters.
  • Folder Job Listings: Organize and access jobs in specific folders.
  • Autocompletion: Enhance the CLI experience with shell autocompletion for bash, zsh, or fish.

Installation 📦

pip3 install jenkinsctl

Jenkins Configuration 🛠️

Before using jenkinsctl, configure your Jenkins server details in your shell profile. Add these lines in your ~/.bashrc or ~/.zshrc file:

export JENKINS_SERVER_URL=http://localhost:8080
export JENKINS_USERNAME=amanshaw4511
export JENKINS_API_KEY=21df49caf41726094323b803a6de363eae

Adjust the values to match your Jenkins server's URL, your username, and the corresponding API key. This configuration is essential for jenkinsctl to interact with Jenkins and execute tasks efficiently.

How to Get the API Token: https://www.baeldung.com/ops/jenkins-api-token

Reload your shell profile:

exec $SHELL

🐳 Docker Usage

You can run jenkinsctl directly via Docker:

docker run --rm \
  -e JENKINS_SERVER_URL="https://your-jenkins.com" \
  -e JENKINS_USERNAME="youruser" \
  -e JENKINS_API_KEY="yourapikey" \
  amanshaw4511/jenkinsctl:latest --help

Commands & Options 🤖

All jenkinsctl commands are designed to be terminal-friendly with structured flags and arguments.

list

List recent builds of a Jenkins job.

jenkinsctl list <job_name> [-n <number_of_builds>]
Option Description
job_name Name of the Jenkins job
-n, --number Number of builds to list (default: 5)

logs

View logs of a specific build.

jenkinsctl logs <job_name> [build_no]
Option Description
job_name Name of the Jenkins job
build_no Build number (optional, defaults to last build)

json

Get JSON API data for a build.

jenkinsctl json <job_name> [build_no]

config

Get build configuration in YAML format.

jenkinsctl config <job_name> [build_no]

rebuild

Trigger a rebuild of a specific job.

jenkinsctl rebuild <job_name> [build_no]

build

Start a new build using YAML configuration with optional parameters.

jenkinsctl build -f <config_file> [--param key=value]
Option Description
-f, --file YAML configuration file for the Jenkins job
--param Key-value pairs to override config parameters

enable-completion

Enable shell autocompletion for streamlined CLI use.

jenkinsctl enable-completion [shell]
Argument Description
shell Optional: specify shell (bash, zsh, or fish)

jobs

List all jobs in a specified Jenkins folder.

jenkinsctl jobs [folder_name]
Option Description
folder_name Folder path for jobs (optional)

Quick Examples 🎭

  1. List Recent Builds: Show the last 10 builds for a job.

    jenkinsctl list my-awesome-job -n 10
    
  2. Get Logs for a Build: View logs for a specific build.

    jenkinsctl logs my-awesome-job 42
    
  3. Start a Build with Parameters: Launch a build with custom parameters.

    jenkinsctl build -f path/to/config.yaml --param version=1.2.3
    

Contributing 🤝

Contributions are welcome! If you want to contribute, fork the repo, make your changes, and submit a pull request. Found an issue? Open an issue in the repo!


Metadata

Release files for jenkinsctl 1.0.23

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jenkinsctl 1.0.23
File Size Uploaded
jenkinsctl-1.0.23.tar.gz 63.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for jenkinsctl 1.0.23
File Interpreter ABI Platform
jenkinsctl-1.0.23-py3-none-any.whl Python 3 none any Details

Total release size: 89.5 kB

Release files / jenkinsctl-1.0.23.tar.gz

Download URL jenkinsctl-1.0.23.tar.gz
Size 63.4 kB
Tags Source
SHA-256 checksum
How to use checksums
ddf4d73edf07d9db6e660407417008cb1dd2b3d47bd47454962fba31ac6ed076
BLAKE2b-256 checksum
How to use checksums
c7844ddc35f58955cf6e3ff564b88ef983ea3636a27958a0befc74b248829aab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.7.13

Release files / jenkinsctl-1.0.23-py3-none-any.whl

Download URL jenkinsctl-1.0.23-py3-none-any.whl
Size 26.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
94edbca9de5c48dedde500dcc07d75f353c5f9f835b108daca16451a0b2cce29
BLAKE2b-256 checksum
How to use checksums
b9c153da98bb32dca65283691445edd69b308b8f8bec106ecbb8807c76bdc04e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.7.13

Release history Release notifications | RSS feed

This release

1.0.23 This release

2 release files

1.0.22

2 release files

1.0.21

2 release files

1.0.20

2 release files

1.0.19

2 release files

1.0.18

2 release files

1.0.17

2 release files

1.0.16

2 release files

1.0.15

2 release files

1.0.14

2 release files

1.0.13

2 release files

1.0.12

2 release files

1.0.11

2 release files

1.0.9

2 release files

1.0.8

2 release files

1.0.7

2 release files

1.0.5

2 release files

1.0.0

2 release files

0.1.0

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page