Skip to content

zhanglianx111/lasa

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Jenkins RESTful API


jenkinsLogo

目录

* [1 JOB](#1) * [1.1 get all jobs information](#1.1) * [1.2 get a job information](#1.2) * [1.3 is job running?](#1.3) * [1.4 create a job](#1.4) * [1.5 delete a job](#1.5) * [1.6 disable a job](#1.6) * [1.7 enable a job](#1.7) * [1.8 rename a job](#1.8) * [1.9 get all builds of a job](#1.9) * [1.10 build a job](#1.10) * [1.11 get build log of a job](#1.11) * [1.12 stop build of a job](#1.12) * [1.13 copy job](#1.13) * [2 NODE](#2) * [2.1 add a node](#2.1) * [2.2 delete a node](#2.2) * [2.3 get all nodes informat](#2.3) * [2.4 get a node information](#2.4) * [2.5 get a node idle info](#2.5) * [2.6 set a node online](#2.6) * [2.7 set a node offline](#2.7) * [2.8 is node online?](#2.8) * [2.9 get node launching log](#2.9) * [2.10 disconnect node](#2.10)

1.JOB

**1.1 get all jobs information**

**Get** */api/job/alljobs* **Response Code :** (Status 200) **response:**(json) ```json [ { "buildable": bool, "builds": [ { "number": int, "url": string }, ], "color": string, "concurrentBuild": bool, "description": string, "displayname": string, "inQueue": bool, "lastBuild": { "number": int, "url": string }, "lastFailedBuild": { "number": int, "url": string }, "lastStableBuild": { "number": int, "url": string }, "lastSuccessfulBuild": { "number": int, "url": string }, "name": string, "url": string } ] ```

**1.2 get a job information**

**Get** */api/job/ajob/{jobname}* *jobname*: job的名字 **Response Code :** (Status 200) **response:**(json) ```json { "buildable": bool, "builds": [ { "number": int, "url": string }, ], "color": string, "concurrentBuild": bool, "description": string, "displayname": string, "inQueue": bool, "lastBuild": { "number": int, "url": string }, "lastFailedBuild": { "number": int, "url": string }, "lastStableBuild": { "number": int, "url": string }, "lastSuccessfulBuild": { "number": int, "url": string }, "name": string, "url": string } ```

**1.3 is job running?**

**Get** */api/job/isrunning/{jobname}* *jobname*: job的名字 **Response Code :** (Status 200) **response:**(bool) ```json bool ```

**1.4 create a job**

**Post** */api/job/create/{jobname}* *jobname*: job的名字 *请求body字段及含义 ```json { "description": string, "scm": { "repositryurl": string, "credentialsid": string, //md5? 544d6bd6-d4f8-4ef0-8411-8b3c211affe2 "branchestobuild": string } "builders": { "dockerbuildandpublish":{ "repositryname": string, // 用户自定义的repo name "tag": string, // images tag infomation, default: latest "dockerhosturi": string, // default: tcp://xxxx:xxx "dockerregistryurl": string, // http://dhub.yunpro.cn "skippush": bool // 是否跳过push到docker registry }, "executeshell": { command: string //用户使用ExecuteShell,默认为"" } } } ``` **Response Code :** (Status 200) ```json { "name": string, // job name } ```

**1.5 delete a job**

**Post** */api/job/delete/{jobname}* *jobname*: job的名字 **Response Code :** (Status 200) ```json { "name": string } ```

**1.6 disable a job**

**Post** */api/job/disable/{jobname}* *jobname*: job的名字 **Response Code :** (Status 200) ```json bool

<h3 id="1.7">**1.7 enable a job**</h3>  
**Post** */api/job/enable/{jobname}*  
*jobname*: job的名字  
**Response Code :** (Status 200)
```json
bool

**1.8 rename a job**

**Post** */api/job/rename/{oldname}/{newname}* *oldname*: job的老名字 *newname*: job的新名字 **Response Code :** (Status 200) ```json string ```

**1.9 get all builds of a job**

**Get** */api/job/{jobname}/allbuilds* *jobname*: job的名字 **Response Code :** (Status 200) ```json [ { "number": int, "url": string }, ] ```

**1.10 build a job**

**Post** */api/job/build/{jobname}* *jobname*: job的名字 **Response Code :** (Status 200) ```json bool ```

**1.11 get build log of a job**

**Post** */api/job/buildlog/{jobname}/{buildnumber}* *jobname*: job的名字 *buildnumber*: build id **Response Code :** (Status 200) ```json strings ```

**1.12 stop build of a job**

**Post** */api/job/stopbuild/{jobname}/{buildnumber}* *jobname*: job的名字 *buildnumber*: build id **Response Code :** (Status 200) ```json bool ```

**1.13 copy job from anothor one**

**Post** */api/job/copy/{from}/{newname}* *from*: job的名字 *newname*: 新job的名字 **Response Code :** (Status 200) ```json bool ``` ###

2 NODE

**2.1 add a node**

**Post** */api/node/create/{nodename}/{numexecutors}/{description}/{remotefs}* **Request Body** ```json "method" string `json:"method"`, "host" string `json:"host"`, "port" string `json:"port"`, "credentialsId" string `json:"credentialsId"`, "jvmOptions" string `json:"jvmOptions"`, "javaPath" string `json:"javaPath"`, "prefixStartSlaveCmd" string `json:"prefixStartSlaveCmd"`, "suffixStartSlaveCmd" string `json:"suffixStartSlaveCmd"`, "maxNumRetries" string `json:"maxNumRetries"`, "retryWaitTime" string `json:"retryWaitTime"`, "lanuchTimeoutSeconds" string `json:"lanuchTimeoutSeconds"`, ``` **Response Code :** (Status 200) ```json bool ```

**2.2 delete a node**

**Post** */api/node/delete/{nodename}* **Response Code :** (Status 200) ```json bool ```

**2.3 get all nodes informat**

**Get** */api/node/allnodes* **Response Code :** (Status 200) ```json [ { "name": string } ] ```

**2.4 get a node information**

**Get** */api/node/anode/{nodename}* **Response Code :** (Status 200) ```json { "displayName": string, "idle": bool, "numExecutors": int, "offline": bool } ```

**2.5 get a node idle info**

**Get** */api/node/isidle/{nodename}* **Response Code :** (Status 200) ```json bool ```

**2.6 set a node online******

**Post** */api/node/online/{nodename}* **Response Code :** (Status 200) ```json bool ```

**2.7 set a node offline**

**Post** */api/node/offline/{nodename}* **Response Code :** (Status 200) ```json bool ```

**2.8 is node online?**

**Get** */api/node/isonline/{nodename}* **Response Code :** (Status 200) ```json bool ```

**2.9 get node launching log**

**Get** */api/node/log/{nodename}* **Response Code :** (Status 200) ```json string ```

**2.10 disconnect node**

**Post** */api/node/disconnect/{nodename}* **Response Code :** (Status 200) ```json bool ```

3 VIEW

**3.1 get all views**

**Get** */api/view/allviews* **Response Code :** (Status 200) ```json [ { "description": string, "jobs": [ { "name": string, "url": string, "color": string }, { "name": string, "url": string, "color": string } ], "name": string, "url": string } ] ```

**3.2 get a view**

**Get** */api/view/{viewname}* **Response Code :** (Status 200) ```json { "description": string, "jobs": [ { "name": string, "url": string, "color": string }, { "name": string, "url": string, "color": string } ], "name": string, "url": string } ```

**3.3 add a view**

**Post** */api/view/create/{viewname}/{type}* **Response Code :** (Status 200) ```json bool ```

**3.4 add a job into view**

**Post** */api/view/addjob/{viewname}/{jobname}* **Response Code :** (Status 200) ```json bool ```

**3.5 delete a job from view**

**Post** */api/view/deletejob/{viewname}/{jobname}* **Response Code :** (Status 200) ```json bool ```

4 LOG

**4.1 get log level**

**Get** */api/log/level* **Response Code :** (Status 200) ```json string ```

**4.2 set log level**

**Post** */api/log/set/{level}* **Response Code :** (Status 200) ```json string ``` ###

5 PLUGINS

**5.1 get all plugins**

**Get** */api/plugins/{depth}* *depth*: - 0: 获取所有plugins - 1:

Response Code : (Status 200)

[
    {
        "active": bool,
        "enabled": bool,
        "name": string,
        "url": string,
        "version": string
    },
]

回到顶部

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published