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 |
createFolder(FolderJob folder,
String jobName)
Create a job on the server (in the given folder)
|
void |
createFolder(FolderJob folder,
String jobName,
Boolean crumbFlag)
Create a job on the server (in the given folder)
|
void |
createFolder(String folderName)
Create a folder on the server (in the root)
|
void |
createFolder(String folderName,
Boolean crumbFlag)
Create a folder on the server (in the root)
|
void |
createJob(FolderJob folder,
String jobName,
String jobXml)
Create a job on the server using the provided xml and in the provided
folder
|
void |
createJob(FolderJob folder,
String jobName,
String jobXml,
Boolean crumbFlag)
Create a job on the server using the provided xml and in the provided
folder
|
void |
createJob(String jobName,
String jobXml)
Create a job on the server using the provided xml
|
void |
createJob(String jobName,
String jobXml,
Boolean crumbFlag)
Create a job on the server using the provided xml
|
void |
deleteJob(FolderJob folder,
String jobName)
Delete a job from Jenkins within a folder.
|
void |
deleteJob(String jobName) |
void |
deleteJob(String jobName,
boolean crumbFlag)
Delete a job from Jenkins.
|
void |
disableJob(String jobName) |
void |
disableJob(String jobName,
boolean crumbFlag)
Disable a job from Jenkins.
|
void |
enableJob(String jobName) |
void |
enableJob(String jobName,
boolean crumbFlag)
Enable 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(). |
com.google.common.base.Optional<FolderJob> |
getFolderJob(Job job) |
JobWithDetails |
getJob(FolderJob folder,
String jobName)
Get a single Job from the given folder.
|
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(FolderJob folder)
Get a list of all the defined jobs on the server (in the given folder)
|
Map<String,Job> |
getJobs(FolderJob folder,
String view)
Get a list of all the defined jobs on the server (at the specified view
level and in the specified folder)
|
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(FolderJob folder,
String jobName) |
MavenJobWithDetails |
getMavenJob(String jobName) |
PluginManager |
getPluginManager()
This will give you back the
PluginManager. |
Queue |
getQueue() |
QueueItem |
getQueueItem(QueueReference ref) |
String |
getVersion() |
View |
getView(FolderJob folder,
String name)
Get a single view object from the given folder
|
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)
|
Map<String,View> |
getViews(FolderJob folder)
Get a list of all the defined views on the server (at the summary level
and in the given folder)
|
boolean |
isRunning()
Get the current status of the Jenkins end-point by pinging it.
|
void |
quietDown()
Sends the Quiet Down (Prepare for shutdown) message
|
void |
renameJob(FolderJob folder,
String oldJobName,
String newJobName)
Rename a job
|
void |
renameJob(FolderJob folder,
String oldJobName,
String newJobName,
Boolean crumbFlag)
Rename a job
|
void |
renameJob(String oldJobName,
String newJobName)
Rename a job
|
void |
renameJob(String oldJobName,
String newJobName,
Boolean crumbFlag)
Rename a job
|
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 String getVersion()
public Map<String,Job> getJobs() throws IOException
IOExceptionpublic Map<String,Job> getJobs(FolderJob folder) throws IOException
IOExceptionpublic Map<String,Job> getJobs(String view) throws IOException
IOExceptionpublic Map<String,Job> getJobs(FolderJob folder, String view) throws IOException
IOExceptionpublic Map<String,View> getViews() throws IOException
IOExceptionpublic Map<String,View> getViews(FolderJob folder) throws IOException
IOExceptionpublic View getView(String name) throws IOException
name - name of the view in JenkinsIOExceptionpublic View getView(FolderJob folder, String name) throws IOException
folder - The name of the folder.name - name of the view in JenkinsIOExceptionpublic JobWithDetails getJob(String jobName) throws IOException
IOExceptionpublic JobWithDetails getJob(FolderJob folder, String jobName) throws IOException
IOExceptionpublic MavenJobWithDetails getMavenJob(String jobName) throws IOException
IOExceptionpublic MavenJobWithDetails getMavenJob(FolderJob folder, String jobName) throws IOException
IOExceptionpublic com.google.common.base.Optional<FolderJob> getFolderJob(Job job) throws IOException
IOExceptionpublic void createJob(String jobName, String jobXml) throws IOException
IOExceptionpublic void createJob(String jobName, String jobXml, Boolean crumbFlag) throws IOException
IOExceptionpublic void createJob(FolderJob folder, String jobName, String jobXml) throws IOException
IOExceptionpublic void createJob(FolderJob folder, String jobName, String jobXml, Boolean crumbFlag) throws IOException
IOExceptionpublic void createFolder(String folderName) throws IOException
IOExceptionpublic void createFolder(String folderName, Boolean crumbFlag) throws IOException
IOExceptionpublic void createFolder(FolderJob folder, String jobName) throws IOException
IOExceptionpublic void createFolder(FolderJob folder, String jobName, 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 PluginManager getPluginManager() throws IOException
PluginManager.PluginManagerIOException - in case of a failure.public 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(FolderJob folder, String jobName) throws IOException
folder - The folder where the given job is located.jobName - The job which should be deleted.IOException - in case of problems.public 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 void disableJob(String jobName) throws IOException
IOExceptionpublic void disableJob(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 void enableJob(String jobName) throws IOException
IOExceptionpublic void enableJob(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 Queue getQueue() throws IOException
IOExceptionpublic QueueItem getQueueItem(QueueReference ref) throws IOException
IOExceptionpublic Build getBuild(QueueItem q) throws IOException
IOExceptionpublic void renameJob(String oldJobName, String newJobName) throws IOException
oldJobName - existing job name.newJobName - The new job name.IOException - In case of a failure.public void renameJob(String oldJobName, String newJobName, Boolean crumbFlag) throws IOException
oldJobName - existing job name.newJobName - The new job name.crumbFlag - true to add crumbIssuer false otherwise.IOException - In case of a failure.public void renameJob(FolderJob folder, String oldJobName, String newJobName) throws IOException
FolderJob - The folder.oldJobName - existing job name.newJobName - The new job name.IOException - In case of a failure.public void renameJob(FolderJob folder, String oldJobName, String newJobName, Boolean crumbFlag) throws IOException
FolderJob - The folder.oldJobName - existing job name.newJobName - The new job name.crumbFlag - true to add crumbIssuer false otherwise.IOException - In case of a failure.Copyright © 2016. All rights reserved.