Skip to content

Commit c3124d5

Browse files
committed
Add usage example to README.md
1 parent 0f38671 commit c3124d5

1 file changed

Lines changed: 92 additions & 9 deletions

File tree

README.md

Lines changed: 92 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
[python-jenkins](https://github.com/openstack/python-jenkins)
99

1010
# Tested on
11-
Jenkins ver: 1.565,
11+
Jenkins ver: 1.565, 1.655
12+
1213
Python ver: 2.7, 3.4, 3.5
1314

1415
# Table of contents
@@ -19,9 +20,12 @@ Python ver: 2.7, 3.4, 3.5
1920

2021
# Installation:
2122

22-
## Using pip
23+
```bash
24+
pip isntall
25+
```
2326

24-
## Clone
27+
or
28+
2529
```bash
2630
git clone https://github.com/LD250/jenkins-cli-python.git
2731
cd jenkins-cli-python
@@ -32,9 +36,14 @@ python setup.py install
3236

3337
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
3438

35-
# Commands overwiew:
36-
```bash
37-
{jobs,queue,building,start,info,set_branch,stop,console}
39+
**.jenkins-cli** example
40+
```txt
41+
host=http://localhost:8082/
42+
username=username
43+
password=******
44+
```
45+
46+
# Commands overview:
3847
jobs Show all jobs and their statuses
3948
queue Shows builds queue
4049
building Build executor status
@@ -45,13 +54,87 @@ Server URL, Username and password may be specified either by the command line ar
4554
console Show console for the build
4655
builds Show builds for job
4756
changes Show build's changes
48-
```
57+
Run `jenkins --help` for detailed help. To see the optional parameters, run `--help` for the specific command. For example `jenkins jobs --help` will show job status description and optional arguments.
58+
4959

5060
# Usage example:
5161

62+
Show status descriptions
63+
```bash
64+
$ jenkins jobs --help
65+
usage: jenkins jobs [-h] [-a] [-p]
66+
67+
Status description:
68+
69+
... -> Unknown
70+
F.. -> Failed
71+
D.. -> Disabled
72+
U.. -> Unstable
73+
D.. -> Disabled
74+
S.. -> Stable
75+
A.. -> Aborted
76+
.>> -> Build in progress
77+
78+
optional arguments:
79+
-h, --help show this help message and exit
80+
-a Show only active jobs
81+
-p Show only jobs thats in build progress
82+
```
83+
Show jobs
84+
```bash
85+
$ jenkins jobs
86+
D.. hudson
87+
S.. jenkins-cli
88+
U>> new-project
89+
```
90+
Show job info
91+
```bash
92+
$ jenkins info jenkins-cli
93+
Last build name: jenkins-cli #18 (result: SUCCESS)
94+
Last success build name: jenkins-cli #18
95+
Build started: 2016-03-31 00:22:38.326999
96+
Building now: No
97+
Git branch set to: master
98+
```
99+
Update VCS branch
100+
```bash
101+
$ jenkins setbranch new-feature
102+
Done
103+
```
104+
Run job
105+
```bash
106+
$ jenkins start jenkins-cli
107+
jenkins-cli: started
108+
```
109+
Check job builds
110+
```bash
111+
$ jenkins builds jenkins-cli
112+
S.. #18 0:00:07 (2 commits)
113+
S.. #17 0:00:08 (2 commits)
114+
F.. #16 0:00:00 (4 commits)
115+
S.. #15 0:00:08 (2 commits)
116+
```
117+
Show previous build changes
118+
```bash
119+
$ jenkins changes jenkins-cli -b 17
120+
1. add .travis.yml from add-travis branch by Denys Levchenko affected 1 files
121+
2. scaffolding for tests by Denys Levchenko affected 5 files
122+
```
123+
Show current job console output (last 13 lines)
52124
```bash
53-
jenkins [-h] [--host jenkins-url] [--username username] [--password password]
54-
{jobs,queue,building,start,info,setbranch,stop,console} ...
125+
$ jenkins console jenkins-cli -n 13
126+
test_jobs (tests.test_cli.TestCliCommands) ... ok
127+
test_queue (tests.test_cli.TestCliCommands) ... ok
128+
test_set_branch (tests.test_cli.TestCliCommands) ... ok
129+
test_start (tests.test_cli.TestCliCommands) ... ok
130+
test_stop (tests.test_cli.TestCliCommands) ... ok
131+
test_read_settings_from_file (tests.test_cli.TestCliFileUsing) ... ok
132+
133+
----------------------------------------------------------------------
134+
Ran 12 tests in 0.015s
135+
136+
OK
137+
Finished: SUCCESS
55138
```
56139

57140
# Tests

0 commit comments

Comments
 (0)