Skip to content

Commit df7add1

Browse files
author
gdy
committed
documentation updated
1 parent ed4fddc commit df7add1

File tree

1 file changed

+70
-67
lines changed

1 file changed

+70
-67
lines changed

README.md

Lines changed: 70 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,70 @@
1-
[![Release](https://jitpack.io/v/ProjectKaiser/pk-jenkins.svg)](https://jitpack.io/#ProjectKaiser/pk-jenkins)
2-
3-
# Overview
4-
Pk-jenkins is a tiny framework used to manage basic Jenkins tasks:
5-
- Jobs copy, create, read, update, delete
6-
- Run and read builds
7-
8-
# Terms
9-
- Job
10-
- Alias of Project in Jenkins terms
11-
- Job Detailed
12-
- An user-level Job description: name, builds list etc
13-
- Job Config Xml
14-
- A Jenkins-level Job description: schtdule, used plugins config etc
15-
- Queue Item
16-
- A build queue element. Represents a separate build for a task: color, state(running, finished, stuck etc) etc
17-
18-
# Using pk-jenkins Api
19-
- Add github-hosted pk-jenkins project as maven dependency using [jitpack.io](https://jitpack.io/). As an example, add following to gradle.build file:
20-
```gradle
21-
allprojects {
22-
repositories {
23-
maven { url "https://jitpack.io" }
24-
}
25-
}
26-
27-
dependencies {
28-
compile 'com.github.ProjectKaiser:pk-jenkins:master-SNAPSHOT'
29-
}
30-
```
31-
- Create IJenkinsApi implementation class providing Jenkins server url, username and password
32-
```java
33-
IJenkinsApi jenkins = new JenkinsApi("http://localhost:8080", "user", "password");
34-
```
35-
- `void createJob(String jobName, String jobConfigXML)`
36-
- Creates new job named `jobName` with provided job config xml. Use `getJobConfigXml()` to obtain one from an existing Job
37-
- `JobDetailed getJobDetailed(String jobName) throws EPKJNotFound`
38-
- Returns Job Detailed object
39-
- `QueueItem getBuild(Long buildId) throws EPKJNotFound`
40-
- Returns Queue item object
41-
- `void updateJobConfigXml(String jobName, String configXml) throws EPKJNotFound`
42-
- Updates Job Config Xml. Xml manipulating is made by caller side, i.e.: `getJobConfigXml()`, then add\remove\change Xml elements, then `updateJobCOnfigXml()`
43-
- `void copyJob(String srcName, String dstName) throws EPKJNotFound, EPKJExists`
44-
- Clones an existing Job
45-
- `List<String> getJobsList()`
46-
- Returns list of all jobs on the server
47-
- `String getJobConfigXml(String jobName) throws EPKJNotFound`
48-
- Returns Job Config Xml as a string
49-
- `void deleteJob(String jobName) throws EPKJNotFound`
50-
- Deletes job
51-
52-
#Functional testing
53-
A working Jenkins server is required to run functional tests.
54-
Also following environment vars or JVM vars must be defined:
55-
- PK_TEST_JENKINS_URL
56-
- URL to the Jenkins server used for tests
57-
- TEST_JENKINS_USER
58-
- Jenkins username used for run tests
59-
- PK_TEST_JENKINS_PASS
60-
- Password of Jenkins user used for run tests
61-
62-
To run functional tests just execute JenkinsApiTest class as JUnit test. All jobs created during testing are deleted after automatically
63-
64-
65-
66-
67-
1+
[![Release](https://jitpack.io/v/ProjectKaiser/pk-jenkins.svg)](https://jitpack.io/#ProjectKaiser/pk-jenkins)
2+
3+
# Overview
4+
Pk-jenkins is a tiny framework used to manage basic Jenkins tasks:
5+
- Jobs copy, create, read, update, delete
6+
- Run and read builds
7+
8+
# Terms
9+
- Job
10+
- Alias of Project in Jenkins terms
11+
- Job Detailed
12+
- An user-level Job description: name, builds list etc
13+
- Job Config Xml
14+
- A Jenkins-level Job description: schedule, used plugins config etc
15+
- Queue Item
16+
- A Jenkins build queue element. Represents a separate build of a Job. Contains such fields as color, state(running, finished, stuck etc) etc
17+
18+
# Using pk-jenkins Api
19+
- Add github-hosted pk-jenkins project as maven dependency using [jitpack.io](https://jitpack.io/). As an example, add following to gradle.build file:
20+
```gradle
21+
allprojects {
22+
repositories {
23+
maven { url "https://jitpack.io" }
24+
}
25+
}
26+
27+
dependencies {
28+
compile 'com.github.ProjectKaiser:pk-jenkins:master-SNAPSHOT'
29+
}
30+
```
31+
- Create IJenkinsApi implementation class providing Jenkins server url, username and password
32+
```java
33+
IJenkinsApi jenkins = new JenkinsApi("http://localhost:8080", "user", "password");
34+
```
35+
- `void createJob(String jobName, String jobConfigXML)`
36+
- Creates new job named `jobName` with provided job config xml. Use `getJobConfigXml()` to obtain one from an existing Job
37+
- `JobDetailed getJobDetailed(String jobName) throws EPKJNotFound`
38+
- Returns Job Detailed object
39+
- `Long enqueueBuild(String jobName)`
40+
- Initiates a new build of job named `jobName` and returns id of this build which could be used in `getBuild` method
41+
- `QueueItem getBuild(Long buildId) throws EPKJNotFound`
42+
- Returns Queue item object
43+
- `void updateJobConfigXml(String jobName, String configXml) throws EPKJNotFound`
44+
- Updates Job Config Xml. Xml manipulating is made by caller side, i.e.: `getJobConfigXml()`, then add\remove\change Xml elements, then `updateJobCOnfigXml()`
45+
- `void copyJob(String srcName, String dstName) throws EPKJNotFound, EPKJExists`
46+
- Clones an existing Job
47+
- `List<String> getJobsList()`
48+
- Returns list of all jobs on the server
49+
- `String getJobConfigXml(String jobName) throws EPKJNotFound`
50+
- Returns Job Config Xml as a string
51+
- `void deleteJob(String jobName) throws EPKJNotFound`
52+
- Deletes job
53+
54+
# Functional testing
55+
A working Jenkins server is required to run functional tests.
56+
Also following environment vars or JVM vars must be defined:
57+
- PK_TEST_JENKINS_URL
58+
- URL to the Jenkins server used for tests
59+
- TEST_JENKINS_USER
60+
- Jenkins username used for run tests
61+
- PK_TEST_JENKINS_PASS
62+
- Password of Jenkins user used to run tests
63+
64+
To run functional tests just execute JenkinsApiTest class as JUnit test or run `gradle test`. All jobs created during testing are deleted after automatically.
65+
66+
67+
68+
69+
70+

0 commit comments

Comments
 (0)