Skip to content

Commit 91d9f53

Browse files
committed
merged with upstream
2 parents 3d7b7af + 62be3e5 commit 91d9f53

3 files changed

Lines changed: 38 additions & 16 deletions

File tree

README.md

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,32 @@
77
**Based on**
88
[python-jenkins](https://github.com/openstack/python-jenkins)
99

10-
# Install:
10+
# Tested on
11+
Jenkins ver: 1.565,
12+
Python ver: 2.7, 3.4, 3.5
13+
14+
# Table of contents
15+
* [Installation](#installation)
16+
* [Commands overwiew](#commands-overwiew)
17+
* [Usage example](#usage-example)
18+
* [Tests](#tests)
19+
20+
# Installation:
21+
22+
## Using pip
23+
24+
## Clone
1125
```bash
1226
git clone https://github.com/LD250/jenkins-cli-python.git
1327
cd jenkins-cli-python
1428
python setup.py install
1529
```
1630

17-
# Usage:
18-
19-
```bash
20-
jenkins [-h] [--host jenkins-url] [--username username] [--password password]
21-
{jobs,queue,building,start,info,setbranch,stop,console} ...
22-
```
31+
## Configuration file (.jencins-cli)
2332

2433
Server URL, Username and password may be specified either by the command line arguments or in configuration file **(.jenkins-cli)**. Command line arguments has the highest priority, after that the **.jenkins-cli** file from current folder is taking into account. If there is no.jenkins-cli file in current folder, settings will be read from **.jenkins-cli** from the home folder
2534

26-
27-
# Available commands:
35+
# Commands overwiew:
2836
```bash
2937
{jobs,queue,building,start,info,set_branch,stop,console}
3038
jobs Show all jobs and their statuses
@@ -38,3 +46,21 @@ Server URL, Username and password may be specified either by the command line ar
3846
builds Show builds for job
3947
changes Show build's changes
4048
```
49+
50+
# Usage example:
51+
52+
```bash
53+
jenkins [-h] [--host jenkins-url] [--username username] [--password password]
54+
{jobs,queue,building,start,info,setbranch,stop,console} ...
55+
```
56+
57+
# Tests
58+
59+
To perfom flake8 checks and run tests similar to Travis
60+
61+
```bash
62+
pip install -r requirements.txt
63+
tox
64+
```
65+
66+

jenkins_cli/cli.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import print_function
22
import os
3-
from time import time
3+
from time import time, sleep
44
import datetime
55
import jenkins
66
import socket
@@ -185,7 +185,7 @@ def info(self, args):
185185
scm_name,
186186
branch_name))
187187

188-
def set_branch(self, args):
188+
def setbranch(self, args):
189189
job_name = self._check_job(args.job_name)
190190
xml = self.jenkins.get_job_config(job_name)
191191
root = ElementTree.fromstring(xml.encode('utf-8'))
@@ -279,8 +279,6 @@ def changes(self, args):
279279
print("%(num)s. %(msg_collor)s%(msg)s%(endcollor)s by %(author_collor)s%(author)s%(endcollor)s affected %(affected_files)s files %(is_merge)s" % params)
280280
else:
281281
print("%(job_name)s %(build_number)s has no changes" % {'job_name': job_name, 'build_number': build_number})
282-
else:
283-
raise CliException('Changesets not found for %s' % job_name)
284282

285283
def console(self, args):
286284
job_name = self._check_job(args.job_name)
@@ -303,7 +301,7 @@ def console(self, args):
303301
if new_line_num > last_line_num:
304302
print("\n".join(console_out[last_line_num:]))
305303
last_line_num = new_line_num
306-
time.sleep(3)
304+
sleep(3)
307305
build_info = self.jenkins.get_build_info(job_name, build_number)
308306

309307
def building(self, args):

requirements.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
pbr==1.3.0
21
python-jenkins==0.4.12
3-
six==1.9.0
42
tox==2.3.1
53
pyfakefs==2.7.0
64
mock==1.3.0

0 commit comments

Comments
 (0)