use of com.offbytwo.jenkins.model.FolderJob in project fabric8 by fabric8io.
the class JenkinsAsserts method displayJobs.
public static void displayJobs(JenkinsServer jenkins, Map<String, Job> jobs, String indent) throws IOException {
Set<Map.Entry<String, Job>> entries = jobs.entrySet();
for (Map.Entry<String, Job> entry : entries) {
String jobName = entry.getKey();
Job job = entry.getValue();
String suffix = "";
JobWithDetails details = job.details();
if (details != null) {
Build lastBuild = details.getLastBuild();
if (lastBuild != null) {
BuildWithDetails buildDetails = lastBuild.details();
if (buildDetails != null) {
String buildId = buildDetails.getId();
if (buildId != null) {
suffix = ": #" + buildId;
}
}
}
}
System.out.println(indent + jobName + suffix);
Optional<FolderJob> optional = jenkins.getFolderJob(job);
if (optional.isPresent()) {
FolderJob folderJob = optional.get();
Map<String, Job> children = folderJob.getJobs();
displayJobs(jenkins, children, indent + INDENT);
}
}
}
Aggregations