jenkinsctl


Namejenkinsctl JSON
Version 1.0.7 PyPI version JSON
download
home_pagehttps://github.com/amanshaw4511/jenkinsctl
SummaryA command-line tool to interact with Jenkins jobs 🚀
upload_time2024-11-11 19:22:30
maintainerAman Shaw
docs_urlNone
authorAman Shaw
requires_python<4.0,>=3.8
licenseGPL-3.0-or-later
keywords jenkins jenkin
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ![jenkinsctl](https://upload.wikimedia.org/wikipedia/commons/thumb/e/e9/Jenkins_logo.svg/226px-Jenkins_logo.svg.png?20120629215426)
# jenkinsctl [![PyPI version](https://badge.fury.io/py/jenkinsctl.svg?)](https://badge.fury.io/py/jenkinsctl) [![Downloads](https://static.pepy.tech/badge/jenkinsctl/week?)](https://pepy.tech/project/jenkinsctl) [![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
# 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 📦
```sh
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:
```sh
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:
```sh
exec $SHELL
```

## Commands & Options 🤖
All `jenkinsctl` commands are designed to be terminal-friendly with structured flags and arguments.

### `list`
List recent builds of a Jenkins job.
```sh
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.
```sh
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.
```sh
jenkinsctl json <job_name> [build_no]
```
### `config`
Get build configuration in YAML format.
```sh
jenkinsctl config <job_name> [build_no]
```

### `rebuild`
Trigger a rebuild of a specific job.
```sh
jenkinsctl rebuild <job_name> [build_no]
```

### `build`
Start a new build using YAML configuration with optional parameters.
```sh
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.
```sh
jenkinsctl enable-completion [shell]
```
| Argument | Description                                           |
|----------|-------------------------------------------------------|
| `shell`  | Optional: specify shell (`bash`, `zsh`, or `fish`)    |

### `jobs`
List all jobs in a specified Jenkins folder.
```sh
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!

---


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/amanshaw4511/jenkinsctl",
    "name": "jenkinsctl",
    "maintainer": "Aman Shaw",
    "docs_url": null,
    "requires_python": "<4.0,>=3.8",
    "maintainer_email": "amanshaw4511@protonmail.com",
    "keywords": "jenkins, jenkin",
    "author": "Aman Shaw",
    "author_email": "amanshaw4511@protonmail.com",
    "download_url": "https://files.pythonhosted.org/packages/61/68/994481a879364b3256472c30349949eb69ee14e79449a6e797cdc99905a4/jenkinsctl-1.0.7.tar.gz",
    "platform": null,
    "description": "![jenkinsctl](https://upload.wikimedia.org/wikipedia/commons/thumb/e/e9/Jenkins_logo.svg/226px-Jenkins_logo.svg.png?20120629215426)\n# jenkinsctl [![PyPI version](https://badge.fury.io/py/jenkinsctl.svg?)](https://badge.fury.io/py/jenkinsctl) [![Downloads](https://static.pepy.tech/badge/jenkinsctl/week?)](https://pepy.tech/project/jenkinsctl) [![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)\n# jenkinsctl \u2013 Jenkins Control Right from Your Terminal \ud83d\ude80\n\n`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\u2014no more web UI hassle!\n\n## Why jenkinsctl? \ud83d\udd25\n\nJenkins 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.\n\n---\n\n### Key Features\n\n- **Quick Build Listings**: View recent builds for any job.\n- **Instant Log Access**: Fetch build logs effortlessly.\n- **JSON & YAML API Data**: Retrieve job configurations and build data in JSON or YAML.\n- **Easy Rebuilds**: Re-run jobs without reopening Jenkins.\n- **Parameterized Builds**: Customize builds with dynamic parameters.\n- **Folder Job Listings**: Organize and access jobs in specific folders.\n- **Autocompletion**: Enhance the CLI experience with shell autocompletion for bash, zsh, or fish.\n\n---\n\n## Installation \ud83d\udce6\n```sh\npip3 install jenkinsctl\n```\n\n## Jenkins Configuration \ud83d\udee0\ufe0f\nBefore using jenkinsctl, configure your Jenkins server details in your shell profile.\nAdd these lines in your ~/.bashrc or ~/.zshrc file:\n```sh\nexport JENKINS_SERVER_URL=http://localhost:8080\nexport JENKINS_USERNAME=amanshaw4511\nexport JENKINS_API_KEY=21df49caf41726094323b803a6de363eae\n```\nAdjust 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.\n\nHow to Get the API Token: https://www.baeldung.com/ops/jenkins-api-token\n\nReload your shell profile:\n```sh\nexec $SHELL\n```\n\n## Commands & Options \ud83e\udd16\nAll `jenkinsctl` commands are designed to be terminal-friendly with structured flags and arguments.\n\n### `list`\nList recent builds of a Jenkins job.\n```sh\njenkinsctl list <job_name> [-n <number_of_builds>]\n```\n| Option         | Description                                    |\n|----------------|------------------------------------------------|\n| `job_name`     | Name of the Jenkins job                        |\n| `-n, --number` | Number of builds to list (default: 5)          |\n\n### `logs`\nView logs of a specific build.\n```sh\njenkinsctl logs <job_name> [build_no]\n```\n| Option      | Description                                       |\n|-------------|---------------------------------------------------|\n| `job_name`  | Name of the Jenkins job                           |\n| `build_no`  | Build number (optional, defaults to last build)   |\n\n### `json`\nGet JSON API data for a build.\n```sh\njenkinsctl json <job_name> [build_no]\n```\n### `config`\nGet build configuration in YAML format.\n```sh\njenkinsctl config <job_name> [build_no]\n```\n\n### `rebuild`\nTrigger a rebuild of a specific job.\n```sh\njenkinsctl rebuild <job_name> [build_no]\n```\n\n### `build`\nStart a new build using YAML configuration with optional parameters.\n```sh\njenkinsctl build -f <config_file> [--param key=value]\n```\n| Option         | Description                                     |\n|----------------|-------------------------------------------------|\n| `-f, --file`   | YAML configuration file for the Jenkins job     |\n| `--param`      | Key-value pairs to override config parameters   |\n\n### `enable-completion`\nEnable shell autocompletion for streamlined CLI use.\n```sh\njenkinsctl enable-completion [shell]\n```\n| Argument | Description                                           |\n|----------|-------------------------------------------------------|\n| `shell`  | Optional: specify shell (`bash`, `zsh`, or `fish`)    |\n\n### `jobs`\nList all jobs in a specified Jenkins folder.\n```sh\njenkinsctl jobs [folder_name]\n```\n| Option       | Description                                   |\n|--------------|-----------------------------------------------|\n| `folder_name`| Folder path for jobs (optional)               |\n\n\n## Quick Examples \ud83c\udfad\n\n1. **List Recent Builds**: Show the last 10 builds for a job.\n    ```\n    jenkinsctl list my-awesome-job -n 10\n    ```\n\n2. **Get Logs for a Build**: View logs for a specific build.\n    ```\n    jenkinsctl logs my-awesome-job 42\n    ```\n\n3. **Start a Build with Parameters**: Launch a build with custom parameters.\n    ```\n    jenkinsctl build -f path/to/config.yaml --param version=1.2.3\n    ```\n\n---\n\n## Contributing \ud83e\udd1d\n\nContributions 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!\n\n---\n\n",
    "bugtrack_url": null,
    "license": "GPL-3.0-or-later",
    "summary": "A command-line tool to interact with Jenkins jobs \ud83d\ude80",
    "version": "1.0.7",
    "project_urls": {
        "Homepage": "https://github.com/amanshaw4511/jenkinsctl",
        "Repository": "https://github.com/amanshaw4511/jenkinsctl"
    },
    "split_keywords": [
        "jenkins",
        " jenkin"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1e7633c116dec29ac7e8c92a3bafe0b1932fc9abdcfca7f1442190b950775e5c",
                "md5": "c47f7fb16d50f52b1595b14cdf2a57eb",
                "sha256": "cfade0136afce4cd3bb213bceab46a1a371a9b71e6b8c808fe1d5e59f28588bd"
            },
            "downloads": -1,
            "filename": "jenkinsctl-1.0.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c47f7fb16d50f52b1595b14cdf2a57eb",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8",
            "size": 25844,
            "upload_time": "2024-11-11T19:22:28",
            "upload_time_iso_8601": "2024-11-11T19:22:28.831506Z",
            "url": "https://files.pythonhosted.org/packages/1e/76/33c116dec29ac7e8c92a3bafe0b1932fc9abdcfca7f1442190b950775e5c/jenkinsctl-1.0.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6168994481a879364b3256472c30349949eb69ee14e79449a6e797cdc99905a4",
                "md5": "99500ca25fcb509625954041b404acbb",
                "sha256": "8b83fd691058cf2112b700e5a5520f6fa169ff14e273c377fc8be21202f2ae91"
            },
            "downloads": -1,
            "filename": "jenkinsctl-1.0.7.tar.gz",
            "has_sig": false,
            "md5_digest": "99500ca25fcb509625954041b404acbb",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8",
            "size": 22423,
            "upload_time": "2024-11-11T19:22:30",
            "upload_time_iso_8601": "2024-11-11T19:22:30.384696Z",
            "url": "https://files.pythonhosted.org/packages/61/68/994481a879364b3256472c30349949eb69ee14e79449a6e797cdc99905a4/jenkinsctl-1.0.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-11 19:22:30",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "amanshaw4511",
    "github_project": "jenkinsctl",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "jenkinsctl"
}
        
Elapsed time: 0.73590s