Work with the libraries python-jenkins and python JIRA

Python-jenkins

Python-jenkins is a python shell for REST API jenkins allowing to provide simple control of the server jenkins.

Installation

$ sudo pip install python-jenkins

Example of connection to server:

import jenkins

server = jenkins.Jenkins('http://localhost:8080', username='myuser', password='mypassword')

The library allows to create/edit/delete goals, to obtain information about compilations, plugins, nodes, to install plugins and more.

Example of getting the list of goals:

jobs = server.get_jobs()

Example of getting information about nodes:

node_config = server.get_node_info('slave1')

Link to documentation: https://python-jenkins.readthedocs.org/en/latest/

Python JIRA

Python-JIRA is a library for easy interaction with JIRA REST API.

Installation

$ pip install jira

Example of connection to server with authorization:

options = {
    'server': JIRA_PROJECT
}

jira = JIRA(options, basic_auth=(JIRA_USERNAME, PASSWORD))

Example of translation tasks to ‘Reopened

issue = jira.issue('GT-1693')
jira.transition_issue(issue, u'Reopened')

Link to documentation: http://pythonhosted.org/jira/

The above libraries are used in the script scripts/find_unsuccessfull_build.py <branch_number>.

ShareShare on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInShare on VKEmail this to someone