Skip to main content

a jenkins command-line tool

Project description

Jenks is a command-line tool, designed to retrieve information and trigger jobs on remote a jenkins host

After filling out a configuration file, getting status on jobs is simply:

$ jenks
0: localhost, foo (last build #7) SUCCESS
1: localhost, bar (last build #3) SUCCESS

Jenks works with unique keys assigned to each job, rather than job names. You can see it in the above example: it’s the 0 and 1 assigned at the beginning of the line.

You can trigger the job foo from above with:

$ jenks -t :0

Get the latest console output from the job bar with:

$ jenks -c :1

Get information about multiple jobs simultaneously by adding multiple keys:

$ jenks -l :10

And you can pull up more information with:

$ jenks docs

Installation

  • since jenkinsapi (one of the dependencies) is only python2 compatible, jenks is currently only python2 compatible.

There’s a few ways to install Jenks.

Through pip:

pip install jenks pip install http://github.com/toumorokoshi/jenks/tarball/master

Through sprinter:

sprinter install https://raw.github.com/toumorokoshi/jenks/master/sprinter.cfg

Configuration (.jenksrc)

Jenks requires a .jenksrc file to configure itself. Jenks searches in the current directory and moves up parent directories until it finds one.

A .jenksrc file should be a yaml file, with a dictionary of hosts and some keys for configuration.

Here is an example .jenksrc file with all options:

'localhost':
  url: 'http://localhost:8080/'
  jobs:
    - foo
    - bar
'http://jenkins.local':
  jobs:
    - baz

the in-depth configuration for a host is:

  • url: the url to the host. If the url doesn’t exist, the host

    name is used as the url

  • jobs: a list of job names to add to the list

Keys

By default, Jenks will perform operations on all jobs in the configuration. However, you can restrict the jobs to specific ones by passing a list of keys. Each job is given a unique key generated by jenks. For example, using -l on the example configuration will yield:

$ jenks -l
0 http://jenkins.local baz
1 localhost foo
2 localhost bar

The character at the beginning of each line is the key. Each key is a single character in the set: [0-9a-zA-Z]. You can pass in a string of characters prefixed with a colon to get information about those:

$ jenks -l :20
0 http://jenkins.local baz
2 localhost bar

You can pass in keys by:

  • keys as an argument:

    $ jenks -c 0
  • keys with standard in:

    $ echo '0' | jenks

Examples

Ones of Jenks’ goals is to follow the Unix philosophy of doing one thing and doing it well. By being a modular part and supporting stdin, it’s possible to chain Jenks with other commands.

For example, here’s a command that only lists status whose host or jobs match a specific regex:

$ jenks -l | grep "foo" | cut -d ' ' -f 1 | jenks
0: localhost, foo (last build #7) SUCCESS

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

jenks-0.2.1.tar.gz (5.1 kB view details)

Uploaded Source

File details

Details for the file jenks-0.2.1.tar.gz.

File metadata

  • Download URL: jenks-0.2.1.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for jenks-0.2.1.tar.gz
Algorithm Hash digest
SHA256 7e04533d548f007b88535807d171b48e5b31583d0da7e76d79345094babbdb09
MD5 21516a956eb5f7a7734f92df4a44144c
BLAKE2b-256 18cced2814b75bbcc4ce6c6977d0d586ede94526ed82d3ad938e704262496c58

See more details on using hashes here.

Supported by

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