Package eu.royalsloth.depbuilder.jenkins
Class JenkinsUtil
- java.lang.Object
-
- eu.royalsloth.depbuilder.jenkins.JenkinsUtil
-
public class JenkinsUtil extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
createConsoleLink(Run<?,?> build)
static List<Node>
getAllAgents()
Get all build agents that are part of the same CI build swarm.static Optional<Run<?,?>>
getBuild(String projectName, int buildNumber)
Get the specific build from the chosen project.static List<Node>
getBuildAgents()
Get jenkins build agents without master nodestatic String
getBuildDurationString(Run<?,?> build)
Get human readable build durationstatic Set<String>
getBuildJobs()
static String
getComputerName(Computer computer)
static String
getComputerName(Node agent)
static Jenkins
getJenkins()
static Job<?,?>
getJob(AbstractProject<?,?> project, String jobName)
Get a jenkins job class (project that you can build).static List<Job<?,?>>
getJobs(AbstractProject<?,?> project, Collection<String> jobNames)
Get jenkins jobs (projects that you can build) via specified job names.static List<Computer>
getOnlineComputers()
static String
getPluginVersion(String pluginName)
-
-
-
Method Detail
-
getJenkins
public static Jenkins getJenkins()
-
getBuildAgents
public static List<Node> getBuildAgents()
Get jenkins build agents without master node- Returns:
- jenkins build agents without master node
-
getAllAgents
public static List<Node> getAllAgents()
Get all build agents that are part of the same CI build swarm.- Returns:
- all build nodes including master (master is the last node in the list)
-
getJobs
public static List<Job<?,?>> getJobs(AbstractProject<?,?> project, Collection<String> jobNames)
Get jenkins jobs (projects that you can build) via specified job names. Job name is the unique name of the project, which you specify when you create a new jenkins project (freestyle, pipeline, etc...)- Returns:
- list of relevant jobs that matches with the specified names.
-
getJob
public static Job<?,?> getJob(AbstractProject<?,?> project, String jobName) throws IllegalStateException
Get a jenkins job class (project that you can build). Job name is unique name of the project which you specify when you create a new jenkins project (freestyle, pipeline)- Throws:
IllegalStateException
- if job with specified name does not exist in Jenkins
-
getBuild
public static Optional<Run<?,?>> getBuild(String projectName, int buildNumber)
Get the specific build from the chosen project.- Returns:
- build or optional if the project or the build number do not exist
-
getBuildDurationString
public static String getBuildDurationString(Run<?,?> build)
Get human readable build duration
-
-