Err-jenkins is a plugin for Err that allows you to interact with Jenkins, a continuous integration tool.
- Support Jenkins 2.x!
- Search / List available jobs.
- List parameters for a given job.
- Create job (workflow-plugin / pipeline standard and multibranch jobs only)
- Enable, Disabled and Delete job.
- Create node (JNLP launcher only).
- Enable, Disabled and Delete node.
- Build jobs with or without parameters.
- Webhook support! Receive REST calls on build success/failure
- Tested with freestyle and pipeline (workflow plugin) jobs.
- Support AUTOINSTALL_DEPS thanks to the
requirements.txt
file.
Have an idea ? Open an issue or send me a Pull Request.
This plugin is tested against Python 2.7+ and 3.3+. It only depends on the python-jenkins
and validators
packages:
pip install python-jenkins validators
As admin of an err chatbot, send the following command over XMPP:
!repos install https://github.com/Djiit/err-jenkins.git
Check out the examples !
Use !help JenkinsBot
to see the available commands and their explanation.
You can set some default configuration values in your Errbot's config.py
:
# Main configuration
JENKINS_URL = 'http://jenkins.example.com' # Must begins with 'http' or 'https'.
JENKINS_USERNAME = 'myuser' # Make sure Jenkins ACL is configured.
JENKINS_PASSWORD = 'mypassword' # Use a password or token.
# Webhooks configuration
JENKINS_RECEIVE_NOTIFICATION = True # If True, this plugin will accept HTTP POST from Jenkins (see configuration below).
JENKINS_CHATROOMS_NOTIFICATION = () # Tuples of chatroom names where Err should post messages from Webhooks. If left empty, all chatrooms will be spammed.
If left undefined, you will have to send configuration commands through chat message to this plugins as in :
!plugin config JenkinsBot {'URL': 'http://jenkins.example.com', 'USERNAME': 'myuser', 'PASSWORD': 'mypassword', 'RECEIVE_NOTIFICATION': True, 'CHATROOMS_NOTIFICATION': ()}
To be able to receive messages based on build success and/or failure :
- Set
JENKINS_RECEIVE_NOTIFICATION
(in config.py) orRECEIVE_NOTIFICATION
' (through chat message) configuration option toTrue
. - Install and enable the Jenkins Notification Plugin
- Configure your project's notifications as in :
Note : if you are using the Pipeline DSL, use this snippet instead :
properties(properties:[[
$class: 'HudsonNotificationProperty',
endpoints: [[
event: 'all', // 'all', 'completed', 'finalized' or 'started'
format: 'JSON',
loglines: 0,
protocol: 'HTTP',
timeout: 30000,
url: 'http://errbot.example.com/jenkins/notification'
]]
]])
This plugin is based on the original work by benvd.