Skip to main content

Jenkins API management CLI and universal command wrapper package

Project description

ngen-j

GitHub PyPI

Jenkins API management CLI tool that also supports executing scripts from /usr/local/bin/ngen-j-*.

Installation

Install from PyPI:

pip install ngen-j

Or install from source:

pip install .

Usage

The ngen-j command provides:

  • Jenkins API management commands
  • Script execution from bundled scripts

Version

Check the version:

ngen-j --version
# or
ngen-j -V

Login

Save Jenkins credentials for easy access:

ngen-j login

The login command will:

  • Prompt for Jenkins URL
  • Ask for authentication method (username+token, username+password, or base64)
  • Save credentials to ~/.ngen-j/.env
  • Test the connection

After login, you can use Jenkins commands without setting environment variables each time.

Check Connection

Validate your Jenkins access and credentials:

ngen-j check

The check command will:

  • Test connection to Jenkins server
  • Verify authentication credentials
  • Display Jenkins version and basic info
  • Show troubleshooting tips if connection fails

Examples:

ngen-j login                    # Setup Jenkins credentials
ngen-j check                    # Validate connection
ngen-j --version               # Check version
ngen-j jobs                     # List all jobs
ngen-j job my-job               # Get job details
ngen-j build my-job             # Trigger build

Jenkins API Management

Manage Jenkins jobs and builds using environment variables for authentication.

Environment Variables

Set the following environment variables for Jenkins authentication:

export JENKINS_URL="https://jenkins.example.com"
export JENKINS_USER="your-username"
export JENKINS_TOKEN="your-api-token"

Alternatively, you can use base64 encoded authentication:

export JENKINS_URL="https://jenkins.example.com"
export JENKINS_AUTH="base64-encoded-user:token"

Jenkins Commands

List all jobs:

ngen-j jobs

Get job details:

ngen-j job <job-name>

Trigger a build:

ngen-j build <job-name>

Script Execution

If you have a bundled script, you can execute it directly:

ngen-j rancher --help
ngen-j rancher version

The CLI will look for scripts in the bundled scripts directory.

How It Works

  1. When you run ngen-j {command}, the CLI dispatcher checks in this order:
    • Built-in commands: Jenkins management commands
    • Scripts: Looks for a script at /usr/local/bin/ngen-j-{command} or bundled scripts
  2. If found, it executes the command with any additional arguments passed
  3. Scripts can be any executable file (bash, sh, Python, or binary)

Adding New Commands

Scripts

  1. Place a script in the ngen_j/scripts/ directory with name ngen-j-{your-command}
  2. Make sure it's executable: chmod +x ngen_j/scripts/ngen-j-{your-command}
  3. Use it with: ngen-j {your-command}

Development

Building the Package

python -m build

Publishing to PyPI

Menggunakan script otomatis:

./publish.sh --test      # Publish ke Test PyPI
./publish.sh --publish   # Publish ke PyPI production

Atau manual:

python -m build
python -m twine check dist/*
python -m twine upload dist/*

Untuk panduan lengkap, lihat PUBLISH.md.

Repository

License

MIT

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

ngen_j-0.1.2.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

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

ngen_j-0.1.2-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file ngen_j-0.1.2.tar.gz.

File metadata

  • Download URL: ngen_j-0.1.2.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for ngen_j-0.1.2.tar.gz
Algorithm Hash digest
SHA256 a73fabdf2f5afe39b6c300cb1ca48b2a316867b7247e664af82b4000847f6ec6
MD5 6000043c50e4b23c4a7ac75b49833350
BLAKE2b-256 178debcd71a50fa2e8090b0d0588959f180c07f215e15890cb2d29b2a1b65e34

See more details on using hashes here.

File details

Details for the file ngen_j-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: ngen_j-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for ngen_j-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3e54cd3c0391f89587eab5541f25ad01e21e4cc5b844110ca87c0bb12cc4053a
MD5 6d02b7ab5af31c81916468b63f7a9723
BLAKE2b-256 f8def04dd7e478a1175a629e575760c83b9ae267d58af151277ef329f9ed7546

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