Search in sources :

Example 6 with BlueRun

use of io.jenkins.blueocean.rest.model.BlueRun in project blueocean-plugin by jenkinsci.

the class RunSearch method findRuns.

public static Iterable<BlueRun> findRuns(Job job, final Link parent) {
    final List<BlueRun> runs = new ArrayList<>();
    Iterable<Job> pipelines;
    if (job != null) {
        pipelines = ImmutableList.of(job);
    } else {
        pipelines = Jenkins.getActiveInstance().getItems(Job.class);
    }
    for (Job p : pipelines) {
        RunList<? extends Run> runList = p.getBuilds();
        for (Run r : runList) {
            runs.add(AbstractRunImpl.getBlueRun(r, new Reachable() {

                @Override
                public Link getLink() {
                    return parent;
                }
            }));
        }
    }
    return runs;
}
Also used : BlueRun(io.jenkins.blueocean.rest.model.BlueRun) ArrayList(java.util.ArrayList) Reachable(io.jenkins.blueocean.rest.Reachable) BlueRun(io.jenkins.blueocean.rest.model.BlueRun) Run(hudson.model.Run) Job(hudson.model.Job)

Aggregations

BlueRun (io.jenkins.blueocean.rest.model.BlueRun)6 Job (hudson.model.Job)4 ArrayList (java.util.ArrayList)3 Run (hudson.model.Run)2 Item (hudson.model.Item)1 TopLevelItem (hudson.model.TopLevelItem)1 Reachable (io.jenkins.blueocean.rest.Reachable)1 BluePipeline (io.jenkins.blueocean.rest.model.BluePipeline)1 BluePipelineNode (io.jenkins.blueocean.rest.model.BluePipelineNode)1 BluePipelineStep (io.jenkins.blueocean.rest.model.BluePipelineStep)1 BlueRunContainer (io.jenkins.blueocean.rest.model.BlueRunContainer)1 IOException (java.io.IOException)1 List (java.util.List)1 MultiBranchProject (jenkins.branch.MultiBranchProject)1 Jenkins (jenkins.model.Jenkins)1 LazyBuildMixIn (jenkins.model.lazy.LazyBuildMixIn)1 StepAtomNode (org.jenkinsci.plugins.workflow.cps.nodes.StepAtomNode)1 FlowNode (org.jenkinsci.plugins.workflow.graph.FlowNode)1 StaplerRequest (org.kohsuke.stapler.StaplerRequest)1