public class JenkinsServer extends Object
| Constructor and Description |
|---|
JenkinsServer(JenkinsHttpClient client)
Create a new Jenkins server directly from an HTTP client (ADVANCED)
|
JenkinsServer(URI serverUri)
Create a new Jenkins server reference given only the server address
|
JenkinsServer(URI serverUri,
String username,
String passwordOrToken)
Create a new Jenkins server reference given the address and credentials
|
| Modifier and Type | Method and Description |
|---|---|
void |
addStringParam(String jobName,
String name,
String description,
String defaultValue) |
void |
cancelQuietDown()
Cancels the Quiet Down (Prepare for shutdown) message
|
void |
createJob(String jobName,
String jobXml)
Create a job on the server using the provided xml
|
void |
createJob(String jobName,
String jobXml,
Boolean crumbFlag) |
void |
deleteJob(String jobName) |
void |
deleteJob(String jobName,
boolean crumbFlag)
Delete a job from Jenkins.
|
Build |
getBuild(QueueItem q) |
Map<String,Computer> |
getComputers()
Get a list of all the computers on the server (at the summary level)
|
ComputerSet |
getComputerSet()
The ComputerSet class will give informations
like
ComputerSet.getBusyExecutors() or
the ComputerSet.getTotalExecutors(). |
JobWithDetails |
getJob(String jobName)
Get a single Job from the server.
|
Map<String,Job> |
getJobs()
Get a list of all the defined jobs on the server (at the summary level)
|
Map<String,Job> |
getJobs(String view)
Get a list of all the defined jobs on the server (at the specified view
level)
|
String |
getJobXml(String jobName)
Get the xml description of an existing job
|
LabelWithDetails |
getLabel(String labelName)
Get the description of an existing Label
|
MavenJobWithDetails |
getMavenJob(String jobName) |
QueueItem |
getQueueItem(QueueReference ref) |
View |
getView(String name)
Get a single view object from the server
|
Map<String,View> |
getViews()
Get a list of all the defined views on the server (at the summary level)
|
boolean |
isRunning()
Get the current status of the Jenkins end-point by pinging it.
|
void |
quietDown()
Sends the Quiet Down (Prepare for shutdown) message
|
String |
runScript(String script)
Runs the provided groovy script on the server and returns the result.
|
void |
updateJob(String jobName,
String jobXml)
Update the xml description of an existing job
|
void |
updateJob(String jobName,
String jobXml,
boolean crumbFlag) |
public JenkinsServer(URI serverUri)
serverUri - address of jenkins server (ex. http://localhost:8080/jenkins)public JenkinsServer(URI serverUri, String username, String passwordOrToken)
serverUri - address of jenkins server (ex. http://localhost:8080/jenkins)username - username to use when connectingpasswordOrToken - password (not recommended) or token (recommended)public JenkinsServer(JenkinsHttpClient client)
client - Specialized client to use.public boolean isRunning()
public Map<String,Job> getJobs() throws IOException
IOExceptionpublic Map<String,View> getViews() throws IOException
IOExceptionpublic View getView(String name) throws IOException
name - name of the view in JenkinsIOExceptionpublic Map<String,Job> getJobs(String view) throws IOException
IOExceptionpublic JobWithDetails getJob(String jobName) throws IOException
IOExceptionpublic MavenJobWithDetails getMavenJob(String jobName) throws IOException
IOExceptionpublic void createJob(String jobName, String jobXml) throws IOException
IOExceptionpublic void createJob(String jobName, String jobXml, Boolean crumbFlag) throws IOException
IOExceptionpublic String getJobXml(String jobName) throws IOException
IOExceptionpublic LabelWithDetails getLabel(String labelName) throws IOException
IOExceptionpublic Map<String,Computer> getComputers() throws IOException
IOExceptionpublic ComputerSet getComputerSet() throws IOException
ComputerSet.getBusyExecutors() or
the ComputerSet.getTotalExecutors().ComputerSetIOExceptionpublic void updateJob(String jobName, String jobXml) throws IOException
IOExceptionpublic void updateJob(String jobName, String jobXml, boolean crumbFlag) throws IOException
IOExceptionpublic void addStringParam(String jobName, String name, String description, String defaultValue) throws IOException, JAXBException, org.dom4j.DocumentException
IOExceptionJAXBExceptionorg.dom4j.DocumentExceptionpublic void quietDown()
throws IOException
IOExceptionpublic void cancelQuietDown()
throws IOException
IOExceptionpublic void deleteJob(String jobName) throws IOException
IOExceptionpublic void deleteJob(String jobName, boolean crumbFlag) throws IOException
jobName - The name of the job to be deleted.crumbFlag - The crumFlag.IOException - In case of an failure.public String runScript(String script) throws IOException
script - IOExceptionpublic QueueItem getQueueItem(QueueReference ref) throws IOException
IOExceptionpublic Build getBuild(QueueItem q) throws IOException
IOExceptionCopyright © 2015. All rights reserved.