use of hudson.model.Result in project hudson-2.x by hudson.
the class MatrixProjectTest method testGetTouchStoneResultConditionChildValue.
@Test
public void testGetTouchStoneResultConditionChildValue() throws IOException {
Result parentResultCondition = Result.SUCCESS;
Result childResultCondition = Result.FAILURE;
MatrixProject parentProject = new MatrixProjectMock("parent");
parentProject.setTouchStoneResultCondition(parentResultCondition);
MatrixProject childProject1 = new MatrixProjectMock("child1");
childProject1.setCascadingProject(parentProject);
childProject1.setTouchStoneResultCondition(childResultCondition);
assertEquals(childProject1.getTouchStoneResultCondition(), childResultCondition);
}
use of hudson.model.Result in project blueocean-plugin by jenkinsci.
the class PipelineNodeTest method countBuilds.
private static int countBuilds(WorkflowJob job, Result status) {
RunList<WorkflowRun> builds = job.getNewBuilds();
Iterator<WorkflowRun> iterator = builds.iterator();
int numBuilds = 0;
while (iterator.hasNext()) {
WorkflowRun build = iterator.next();
Result buildRes = build.getResult();
if (status == null || buildRes == status) {
numBuilds++;
}
}
return numBuilds;
}
use of hudson.model.Result 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;
}
use of hudson.model.Result in project promoted-builds-plugin by jenkinsci.
the class KeepBuildForeverAction method perform.
@Override
public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
PrintStream console = listener.getLogger();
// only applicable to promotions, so should be impossible not to be one, but check anyway
if (!(build instanceof Promotion)) {
console.println(Messages.KeepBuildForEverAction_console_notPromotion());
build.setResult(Result.FAILURE);
return false;
}
final Result buildResult = build.getResult();
if (buildResult != null && buildResult.isWorseThan(PROMOTION_RESULT_MUST_BE_AT_LEAST)) {
console.println(Messages.KeepBuildForEverAction_console_promotionNotGoodEnough(build.getResult()));
return true;
}
AbstractBuild promoted = ((Promotion) build).getTarget();
console.println(Messages.KeepBuildForEverAction_console_keepingBuild());
promoted.keepLog();
return true;
}
Aggregations