本文整理了Java中hudson.model.Job.getBuildHealth()
方法的一些代码示例,展示了Job.getBuildHealth()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Job.getBuildHealth()
方法的具体详情如下:
包路径:hudson.model.Job
类名称:Job
方法名:getBuildHealth
[英]Get the current health report for a job.
[中]获取作业的当前运行状况报告。
代码示例来源:origin: org.jenkins-ci.plugins/python-wrapper
public HealthReport superGetBuildHealth() {
return super.getBuildHealth();
}
代码示例来源:origin: org.jenkins-ci.plugins/nested-view
/**
* Returns the health of a normal view.
*/
private static HealthReportContainer getHealthForNormalView(View view) {
HealthReportContainer hrc = new HealthReportContainer();
for (TopLevelItem item : view.getItems()) {
if (item instanceof Job) {
Job job = (Job) item;
if (job.getBuildHealthReports().isEmpty()) continue;
hrc.sum += job.getBuildHealth().getScore();
hrc.count++;
}
}
hrc.report = hrc.count > 0
? new HealthReport(hrc.sum / hrc.count, Messages._ViewHealth(hrc.count))
: null;
return hrc;
}
代码示例来源:origin: jenkinsci/cloudbees-folder-plugin
public static HealthReport getHealthReport(Item item) {
if (item instanceof Job) {
return ((Job) item).getBuildHealth();
}
if (item instanceof Folder) {
return ((Folder) item).getBuildHealth();
}
try {
Method getBuildHealth = item.getClass().getMethod("getBuildHealth");
return (HealthReport) getBuildHealth.invoke(item);
} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
// ignore best effort only
}
return null;
}
代码示例来源:origin: org.jenkins-ci.plugins/cloudbees-folder
public static HealthReport getHealthReport(Item item) {
if (item instanceof Job) {
return ((Job) item).getBuildHealth();
}
if (item instanceof Folder) {
return ((Folder) item).getBuildHealth();
}
try {
Method getBuildHealth = item.getClass().getMethod("getBuildHealth");
return (HealthReport) getBuildHealth.invoke(item);
} catch (NoSuchMethodException e) {
// ignore best effort only
} catch (InvocationTargetException e) {
// ignore best effort only
} catch (IllegalAccessException e) {
// ignore best effort only
}
return null;
}
代码示例来源:origin: org.jenkins-ci.plugins/python-wrapper
@Override
public HealthReport getBuildHealth() {
initPython();
if (pexec.isImplemented(62)) {
return (HealthReport) pexec.execPython("get_build_health");
} else {
return super.getBuildHealth();
}
}
代码示例来源:origin: org.jvnet.hudson.plugins/nested-view
private static void healthCounter(HealthReportContainer hrc, View view) {
if (view instanceof NestedView) {
for (View v : ((NestedView)view).getViews())
healthCounter(hrc, v);
} else {
for (TopLevelItem item : view.getItems())
if (item instanceof Job) {
hrc.sum += ((Job)item).getBuildHealth().getScore();
hrc.count++;
}
}
}
代码示例来源:origin: org.jenkins-ci.plugins/sectioned-view
public int compare(Job o1, Job o2) {
// first compare by status
Result r1 = getResult(o1);
Result r2 = getResult(o2);
if (r1 != null && r2 != null) {
if (r1.isBetterThan(r2)) {
return 1;
} else if (r1.isWorseThan(r2)) {
return -1;
}
}
HealthReport h1 = o1.getBuildHealth();
HealthReport h2 = o2.getBuildHealth();
if (h1 != null && h2 != null) {
// second compare by stability
int health = h1.compareTo(h2);
if (health != 0) {
return health;
}
}
// finally compare by name
return o1.getName().compareTo(o2.getName());
}
}
代码示例来源:origin: org.jenkins-ci.plugins/nested-view
for (TopLevelItem item : items) {
if (item instanceof Job) {
hrc.sum += ((Job) item).getBuildHealth().getScore();
hrc.count++;
代码示例来源:origin: org.jvnet.hudson.plugins/dashboard-view
public static HealthStatus getHealthStatus(Job job){
int score = job.getBuildHealth().getScore();
int nBuilds = job.getBuilds().size();
if (score < 20) {
return HEALTH_0_TO_19;
} else if (score < 40) {
return HEALTH_20_TO_39;
} else if (score < 60) {
return HEALTH_40_TO_59;
} else if (score < 80) {
return HEALTH_60_TO_79;
} else if (score >= 79){
if(nBuilds != 0)
return HEALTH_OVER_80;
else
return HEALTH_UNKNOWN;
}
else{
return HEALTH_UNKNOWN;
}
}
内容来源于网络,如有侵权,请联系作者删除!