jenkins plugin for helga
Project description
A Jenkins plugin for helga chat bot
About
Helga is a Python chat bot. Full documentation can be found at http://helga.readthedocs.org.
This Jenkins plugin allows Helga to run Jenkins playbooks from IRC and return information when they succeed or fail. For example:
03:14 < alfredodeza> !jenkins ceph version=0.80.8.1 branch=rhcs-v0.80.8 release=stable clean=true 03:14 < helgabot> running: ceph jop at http://jenkins.example.com/job/ceph/323
Failed builds will report back minimal information with an optional paste of the log:
03:17 < helgabot> alfredodeza: build ceph/323 failed. Details at http://jenkins.example.com/job/ceph/323/console
Successful runs will also report back to the user:
03:19 < helgabot> alfredodeza: build ceph/323 suceeded!
Installation
This Jenkins plugin is available from PyPI, so you can simply install it with pip:
pip install helga-jenkins
If you want to hack on the helga-jenkins source code, in your virtualenv where you are running Helga, clone a copy of this repository from GitHub and run python setup.py develop.
Configuration
In your settings.py file (or whatever you pass to helga --settings), you can configure a few general things like credentials and Jenkins locations.
In most cases, the plugin will only be configured for a single Jenkins instance, but there is support for multiple instances if configured to do so.
Single Instance
A single instance can be configured as follows (listed with some defaults):
# simple authentication JENKINS_USERNAME = "alfredodeza" JENKINS_PASSWORD = "ElCapitano2" # Jenkins url JENKINS_URL = "http://jenkins.example.com" # for multiple auth/tokens, define a 'credentials' dictionary JENKINS_CREDENTIALS = { "alfredodeza": { "username": "adeza", "token": "33b3ffadgg3v61g1bfd6fd8543df50e4", } }
For multiple users, it is useful to map IRC nicks to usernames in Jenkins, allowing a user to have different usernames (often the case).
Multiple Instances
For multiple instances, it is required to have defined a key that holds the information for connections and users:
# Multiple Jenkins MULTI_JENKINS = { "test": { # URL is always required 'url': 'http://test_jenkins.example.com', 'credentials': { "alfredodeza": { "username": "adeza", "token": "33b3ffadgg3v61g1bfd6fd8543df50e4", }, "ktdreyer": { "username": "kdreyer", "token": "44bh4gggg3dkjasdweiuhr780wer234ss", } }, "prod": { # if no credentials per-user is supplied, define a global one that # any user can use 'url': 'http://test_jenkins.example.com', 'username': 'admin', 'password': 'secret', }
Note that each key in MULTI_JENKINS will equate to a supported command when invoking it on IRC, for example:
<alfredodeza> !ci test build test-job
Where test is a configured Jenkins instance. Or:
<alfredodeza> !ci prod build other-job
Either credentials (with IRC nicks as keys, as username and tokens) or username and password must exist, the bot will fallback from one to the other depending on what is defined and available to connect.
sub commands
There are a few commands that are allowed, you can trigger their exampe usage at any time with:
!ci help {command}
This is a list of all the available ones with a short description of what they do (most of them will require a job name argument at the very least):
enable: Enable a disabled job.
disable: Disable an enabled job.
build: Trigger a job build, will probably need authentication.
health: Report on the current health of a job.
builds: Report on the last builds of a job
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
File details
Details for the file helga-jenkins-0.0.5.tar.gz
.
File metadata
- Download URL: helga-jenkins-0.0.5.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | beafdddcb656d90a079d19f731407e63aa2fc987a8eae9fd2fadc78e84eb0624 |
|
MD5 | c6162610f66eca8f600a55467c830fa8 |
|
BLAKE2b-256 | 9ecc111453b83bfb9eecd0f73cae41dc5cdbe50b790f71eba97918ab47b5ae48 |