jenkinsctl


Namejenkinsctl JSON
Version 0.1.0 PyPI version JSON
download
home_page
SummaryBuild Jenkins jobs effortlessly using a single command. 🚀
upload_time2024-02-16 16:38:03
maintainer
docs_urlNone
author
requires_python>=3.8
license
keywords jenkins jenkin
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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)
Build Jenkins jobs effortlessly using a single command. 🚀

## Installation 📦

```sh
pip 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
## Usage 🤖
```sh
$ jenkinsctl --help
usage: jenkinsctl [-h] {build,config} ...

options:
  -h, --help      show this help message and exit

Subcommand:
  {build,config}
    build         run new build
    config        get config of a build
```

### Run a Jenkins Job
```sh
$ jenkinsctl build --help
usage: jenkinsctl build [-h] [-f FILE] [-v] [-s SUPPRESS_LOGS] [--param PARAM]

options:
  -h, --help            show this help message and exit
  -f FILE, --file FILE  Yaml configuration file
  -v, --verbose
  -s SUPPRESS_LOGS, --suppress-logs SUPPRESS_LOGS
  --param PARAM
```

### Get Config of a Jenkin Build in YAML Format
```sh
$ jenkinsctl config --help
usage: jenkinsctl config [-h] job_name build_no

positional arguments:
  job_name
  build_no

options:
  -h, --help  show this help message and exit
```

## Examples 🎭
### Runing a Jenkins Job
Create a YAML configuration file, let's say `my_job.yaml`, with job parameters like this:
```yaml
job: my_job
params:
    param1: some value
    param2: 10
    param3: true
```
Initiate the job build using the following command:
```sh
jenkinsctl build -f my_job.yaml
```
This command executes the job based on the specified YAML configuration.

### Overriding Specific Parameter from Configuration
```sh
jenkinsctl build -f my_job.yaml --param param2=11 --param param3=false
```
This command will override the value of `param2` and `param3` from original configuration file `my_job.yaml`, passing an effective configuration as follows to run jenkin job :
```yaml
job: my_job
params:
    param1: some value
    param2: 11
    param3: false
```
.. |PyPI-Downloads| image:: https://img.shields.io/pypi/dm/shtab.svg?label=pypi%20downloads&logo=PyPI&logoColor=white
   :target: https://pepy.tech/project/shtab
   :alt: Downloads

### Generating Config from Existing Builds
Capture and reproduce configurations from previous Jenkins builds.
To generate a YAML configuration file from a specific build (e.g. 2nd build) of a job (e.g., `my_job`), use the following command:
```sh
jenkinsctl config my_job 2 > my_job.yaml
```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "jenkinsctl",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "jenkins,jenkin",
    "author": "",
    "author_email": "Aman Shaw <amanshaw4511@protonmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/25/40/1b523e6c71e8870d0b62f303d22905aae02f3fad5bfe1e5e3b54a001a666/jenkinsctl-0.1.0.tar.gz",
    "platform": null,
    "description": "# 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)\nBuild Jenkins jobs effortlessly using a single command. \ud83d\ude80\n\n## Installation \ud83d\udce6\n\n```sh\npip 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## Usage \ud83e\udd16\n```sh\n$ jenkinsctl --help\nusage: jenkinsctl [-h] {build,config} ...\n\noptions:\n  -h, --help      show this help message and exit\n\nSubcommand:\n  {build,config}\n    build         run new build\n    config        get config of a build\n```\n\n### Run a Jenkins Job\n```sh\n$ jenkinsctl build --help\nusage: jenkinsctl build [-h] [-f FILE] [-v] [-s SUPPRESS_LOGS] [--param PARAM]\n\noptions:\n  -h, --help            show this help message and exit\n  -f FILE, --file FILE  Yaml configuration file\n  -v, --verbose\n  -s SUPPRESS_LOGS, --suppress-logs SUPPRESS_LOGS\n  --param PARAM\n```\n\n### Get Config of a Jenkin Build in YAML Format\n```sh\n$ jenkinsctl config --help\nusage: jenkinsctl config [-h] job_name build_no\n\npositional arguments:\n  job_name\n  build_no\n\noptions:\n  -h, --help  show this help message and exit\n```\n\n## Examples \ud83c\udfad\n### Runing a Jenkins Job\nCreate a YAML configuration file, let's say `my_job.yaml`, with job parameters like this:\n```yaml\njob: my_job\nparams:\n    param1: some value\n    param2: 10\n    param3: true\n```\nInitiate the job build using the following command:\n```sh\njenkinsctl build -f my_job.yaml\n```\nThis command executes the job based on the specified YAML configuration.\n\n### Overriding Specific Parameter from Configuration\n```sh\njenkinsctl build -f my_job.yaml --param param2=11 --param param3=false\n```\nThis command will override the value of `param2` and `param3` from original configuration file `my_job.yaml`, passing an effective configuration as follows to run jenkin job :\n```yaml\njob: my_job\nparams:\n    param1: some value\n    param2: 11\n    param3: false\n```\n.. |PyPI-Downloads| image:: https://img.shields.io/pypi/dm/shtab.svg?label=pypi%20downloads&logo=PyPI&logoColor=white\n   :target: https://pepy.tech/project/shtab\n   :alt: Downloads\n\n### Generating Config from Existing Builds\nCapture and reproduce configurations from previous Jenkins builds.\nTo generate a YAML configuration file from a specific build (e.g. 2nd build) of a job (e.g., `my_job`), use the following command:\n```sh\njenkinsctl config my_job 2 > my_job.yaml\n```\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Build Jenkins jobs effortlessly using a single command. \ud83d\ude80",
    "version": "0.1.0",
    "project_urls": {
        "Homepage": "https://github.com/amanshaw4511/jenkinsctl",
        "Issues": "https://github.com/amanshaw4511/jenkinsctl/issues",
        "Repository": "https://github.com/amanshaw4511/jenkinsctl"
    },
    "split_keywords": [
        "jenkins",
        "jenkin"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5584b7d8037b8e86b31b34ca4bbf3696bf37683bb7e1f43aa30f7776ae547f01",
                "md5": "c8d342361e8f8c2c95df2ea61bb801ea",
                "sha256": "c4d693a7551e613820b3010b5618734bd9e240ddeef3ab533f5ed99b4c6c48b5"
            },
            "downloads": -1,
            "filename": "jenkinsctl-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c8d342361e8f8c2c95df2ea61bb801ea",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 18256,
            "upload_time": "2024-02-16T16:38:02",
            "upload_time_iso_8601": "2024-02-16T16:38:02.467188Z",
            "url": "https://files.pythonhosted.org/packages/55/84/b7d8037b8e86b31b34ca4bbf3696bf37683bb7e1f43aa30f7776ae547f01/jenkinsctl-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "25401b523e6c71e8870d0b62f303d22905aae02f3fad5bfe1e5e3b54a001a666",
                "md5": "3e3cecae3cce1a8e0581954ba4d631ad",
                "sha256": "758003a5c412200884e3db04f3e88f262ba02335f804041f73c4c0e06b4c974c"
            },
            "downloads": -1,
            "filename": "jenkinsctl-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "3e3cecae3cce1a8e0581954ba4d631ad",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 17125,
            "upload_time": "2024-02-16T16:38:03",
            "upload_time_iso_8601": "2024-02-16T16:38:03.675922Z",
            "url": "https://files.pythonhosted.org/packages/25/40/1b523e6c71e8870d0b62f303d22905aae02f3fad5bfe1e5e3b54a001a666/jenkinsctl-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-16 16:38:03",
    "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.18318s