Search in sources :

Example 16 with AbstractProject

use of hudson.model.AbstractProject in project promoted-builds-plugin by jenkinsci.

the class DownstreamPassCondition method isMet.

@Override
public PromotionBadge isMet(PromotionProcess promotionProcess, AbstractBuild<?, ?> build) {
    Badge badge = new Badge();
    PseudoDownstreamBuilds pdb = build.getAction(PseudoDownstreamBuilds.class);
    EnvVars buildEnvironment = new EnvVars(build.getBuildVariables());
    OUTER: for (AbstractProject<?, ?> j : getJobList(build.getProject().getParent(), buildEnvironment)) {
        for (AbstractBuild<?, ?> b : build.getDownstreamBuilds(j)) {
            if (!b.isBuilding()) {
                Result r = b.getResult();
                if ((r == Result.SUCCESS) || (evenIfUnstable && r == Result.UNSTABLE)) {
                    badge.add(b);
                    continue OUTER;
                }
            }
        }
        if (pdb != null) {
            // if fingerprint doesn't have any, try the pseudo-downstream
            for (AbstractBuild<?, ?> b : pdb.listBuilds(j)) {
                if (!b.isBuilding()) {
                    Result r = b.getResult();
                    if ((r == Result.SUCCESS) || (evenIfUnstable && r == Result.UNSTABLE)) {
                        badge.add(b);
                        continue OUTER;
                    }
                }
            }
        }
        // none of the builds of this job passed.
        return null;
    }
    return badge;
}
Also used : EnvVars(hudson.EnvVars) AbstractBuild(hudson.model.AbstractBuild) PromotionBadge(hudson.plugins.promoted_builds.PromotionBadge) AbstractProject(hudson.model.AbstractProject) Result(hudson.model.Result)

Aggregations

AbstractProject (hudson.model.AbstractProject)16 Hudson (hudson.model.Hudson)4 ArrayList (java.util.ArrayList)3 AbstractBuild (hudson.model.AbstractBuild)2 Run (hudson.model.Run)2 SubmittedResult (com.qasymphony.ci.plugin.model.SubmittedResult)1 ReadSubmitLogRequest (com.qasymphony.ci.plugin.store.ReadSubmitLogRequest)1 Binding (groovy.lang.Binding)1 GroovyShell (groovy.lang.GroovyShell)1 AbortException (hudson.AbortException)1 DependencyRunner (hudson.DependencyRunner)1 ProjectRunnable (hudson.DependencyRunner.ProjectRunnable)1 EnvVars (hudson.EnvVars)1 PermalinkList (hudson.PermalinkList)1 WorkspaceSnapshot (hudson.WorkspaceSnapshot)1 Action (hudson.model.Action)1 UpstreamCause (hudson.model.Cause.UpstreamCause)1 DependencyGraph (hudson.model.DependencyGraph)1 Dependency (hudson.model.DependencyGraph.Dependency)1 Item (hudson.model.Item)1