Skip to main content

Build Jenkins jobs effortlessly using a single command. 🚀

Project description

jenkinsctl

Build Jenkins jobs effortlessly using a single command. 🚀

Installation 📦

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:

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.

Usage 🤖

$ 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

$ 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

$ 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:

job: my_job
params:
    param1: some value
    param2: 10
    param3: true

Initiate the job build using the following command:

jenkinsctl build -f my_job.yaml

This command executes the job based on the specified YAML configuration.

Overriding Specific Parameter from Configuration

jenkinsctl build -f my_job.yaml --param param2=11 --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 :

job: my_job
params:
    param1: some value
    param2: 11
    param3: false

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:

jenkinsctl config my_job 2 > my_job.yaml

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jenkinsctl-0.0.5.tar.gz (21.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jenkinsctl-0.0.5-py3-none-any.whl (25.6 kB view details)

Uploaded Python 3

File details

Details for the file jenkinsctl-0.0.5.tar.gz.

File metadata

  • Download URL: jenkinsctl-0.0.5.tar.gz
  • Upload date:
  • Size: 21.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.1

File hashes

Hashes for jenkinsctl-0.0.5.tar.gz
Algorithm Hash digest
SHA256 d0ea0680bd04777ed25d5794a2503501f59914c6f54e085aa178185ea092b8a0
MD5 faece3986fb243e0b0b67bf02411482f
BLAKE2b-256 7722ade44c090c310a048b13b4fab1c386e5ab219336820282ba68cb6842f4b9

See more details on using hashes here.

File details

Details for the file jenkinsctl-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: jenkinsctl-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 25.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.1

File hashes

Hashes for jenkinsctl-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 1192d641e6db7490fe8662952ca8bd27ec5ab919f83e1c1e880855a634be39da
MD5 b4468824fb032c9fdcd5a63f0296ae29
BLAKE2b-256 fcadfa62064bb27f1d0f8d0900716b2466b1af4d527d3c8a8b279f3d335d8087

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page