本文整理了Java中hudson.model.Run.getPreviousCompletedBuild
方法的一些代码示例,展示了Run.getPreviousCompletedBuild
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Run.getPreviousCompletedBuild
方法的具体详情如下:
包路径:hudson.model.Run
类名称:Run
方法名:getPreviousCompletedBuild
[英]Gets the most recent #isBuilding() build excluding 'this' Run itself.
[中]获取最新的#isBuilding()生成,不包括“this”运行本身。
代码示例来源:origin: jenkinsci/jenkins
/**
* Method used for actually calculating the culprits from scratch. Called by {@link #getCulprits()} and
* overrides of {@link #getCulprits()}. Does not persist culprits information.
*
* @return a non-null {@link Set} of {@link User}s associated with this item.
*/
@SuppressWarnings("unchecked")
@Nonnull
default Set<User> calculateCulprits() {
Set<User> r = new HashSet<>();
RunT p = ((RunT)this).getPreviousCompletedBuild();
if (p != null) {
Result pr = p.getResult();
if (pr != null && pr.isWorseThan(Result.SUCCESS)) {
// we are still building, so this is just the current latest information,
// but we seems to be failing so far, so inherit culprits from the previous build.
r.addAll(p.getCulprits());
}
}
for (ChangeLogSet<? extends ChangeLogSet.Entry> c : getChangeSets()) {
for (ChangeLogSet.Entry e : c) {
r.add(e.getAuthor());
}
}
return r;
}
代码示例来源:origin: jenkinsci/performance-plugin
private void loadPreviousBuilds() {
Run<?, ?> prev = getBuild().getPreviousCompletedBuild();
while (prev != null) {
getReportMap(prev);
prev = prev.getPreviousCompletedBuild();
}
}
代码示例来源:origin: jenkinsci/performance-plugin
private Map<Run<?, ?>, Map<String, PerformanceReport>> getBuildReports(String parameter, Run<?, ?> previousBuild) throws IOException {
final Map<Run<?, ?>, Map<String, PerformanceReport>> buildReports = new LinkedHashMap<Run<?, ?>, Map<String, PerformanceReport>>();
while (previousBuild != null) {
final Run<?, ?> currentBuild = previousBuild;
parseReports(currentBuild, TaskListener.NULL,
new PerformanceReportCollector() {
public void addAll(Collection<PerformanceReport> parse) {
for (PerformanceReport performanceReport : parse) {
if (buildReports.get(currentBuild) == null) {
Map<String, PerformanceReport> map = new LinkedHashMap<String, PerformanceReport>();
buildReports.put(currentBuild, map);
}
buildReports.get(currentBuild).put(
performanceReport.getReportFileName(), performanceReport);
}
}
}, parameter);
previousBuild = previousBuild.getPreviousCompletedBuild();
}
return buildReports;
}
代码示例来源:origin: jenkinsci/xunit-plugin
private TestResult getPreviousTestResult(Run<?, ?> build) {
Run<?, ?> previousBuild = build.getPreviousCompletedBuild();
if (previousBuild == null) {
return null;
}
TestResultAction previousAction = previousBuild.getAction(TestResultAction.class);
if (previousAction == null) {
return null;
}
return previousAction.getResult();
}
代码示例来源:origin: jenkinsci/performance-plugin
private void addPreviousBuildReports() {
for (Map.Entry<String, PerformanceReport> item : getPerformanceReportMap().entrySet()) {
PerformanceReport curReport = item.getValue();
int baselineBuild = curReport.getBaselineBuild();
PerformanceReport reportForCompare = (baselineBuild == 0) ?
getPerformanceReportForBuild(getBuild().getPreviousCompletedBuild(), item.getKey()) :
getPerformanceReportForBuild(getBuild(baselineBuild), item.getKey());
if (reportForCompare != null) {
curReport.setLastBuildReport(reportForCompare);
}
}
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
/**
* Method used for actually calculating the culprits from scratch. Called by {@link #getCulprits()} and
* overrides of {@link #getCulprits()}. Does not persist culprits information.
*
* @return a non-null {@link Set} of {@link User}s associated with this item.
*/
@SuppressWarnings("unchecked")
@Nonnull
default Set<User> calculateCulprits() {
Set<User> r = new HashSet<>();
RunT p = ((RunT)this).getPreviousCompletedBuild();
if (p != null) {
Result pr = p.getResult();
if (pr != null && pr.isWorseThan(Result.SUCCESS)) {
// we are still building, so this is just the current latest information,
// but we seems to be failing so far, so inherit culprits from the previous build.
r.addAll(p.getCulprits());
}
}
for (ChangeLogSet<? extends ChangeLogSet.Entry> c : getChangeSets()) {
for (ChangeLogSet.Entry e : c) {
r.add(e.getAuthor());
}
}
return r;
}
代码示例来源:origin: jenkinsci/copyartifact-plugin
public boolean isValid(Job<?,?> job) {
if (filters.isEmpty()) return false; // Unable to parse text after /
// Consider the filter valid for this job if any build for this job has all the filter params
outer:
for (Run<?,?> run = job.getLastCompletedBuild(); run != null; run = run.getPreviousCompletedBuild()) try {
EnvVars env = run.getEnvironment(TaskListener.NULL);
for (StringParameterValue spv : filters) {
if (!env.containsKey(spv.getName())) {
continue outer;
}
}
return true;
} catch (InterruptedException ignore) {
} catch (IOException ignore) {
}
return false;
}
代码示例来源:origin: jenkinsci/testng-plugin-plugin
public TestNGTestResultBuildAction getLastCompletedBuildAction() {
for (Run<?, ?> build = getProject().getLastCompletedBuild();
build != null; build = build.getPreviousCompletedBuild()) {
final TestNGTestResultBuildAction action = build.getAction(getBuildActionClass());
if (action != null) {
return action;
}
}
return null;
}
代码示例来源:origin: jenkinsci/email-ext-plugin
Run<?, ?> build = run;
builds.add(build);
build = build.getPreviousCompletedBuild();
while (build != null) {
final Result buildResult = build.getResult();
build = build.getPreviousCompletedBuild();
代码示例来源:origin: jenkinsci/testng-plugin-plugin
/**
* Gets the latest build before this one and returns it's test result.
*
* We'd rather make this list when needed otherwise if we cache these values
* in the memory we will run out of memory
*
* @return previous build test results if the build exists and has a
* {@link hudson.plugins.testng.TestNGTestResultBuildAction},
* otherwise returns an empty {@link hudson.plugins.testng.results.TestNGResult}
* object. <b>Never returns {@code null}.</b>
*/
public static TestNGResult getPreviousBuildTestResults(Run<?, ?> owner) {
// Doesn't make sense to return a build that is still running.
// We can compare results with a previous build that completed
Run<?, ?> previousBuild = owner.getPreviousCompletedBuild();
if (previousBuild != null
&& previousBuild.getAction(TestNGTestResultBuildAction.class) != null) {
return previousBuild.getAction(TestNGTestResultBuildAction.class).getResult();
} else {
return new TestNGResult();
}
}
代码示例来源:origin: jenkinsci/copyartifact-plugin
/**
* Find a build to copy artifacts from.
* @param job Source project
* @param env Environment for build that is copying artifacts
* @param filter Additional filter; returned result should return true (return null otherwise)
* @param parent Build to which artifacts are being copied
* @return Build to use, or null if no appropriate build was found
*/
public Run<?,?> getBuild(Job<?,?> job, EnvVars env, BuildFilter filter, Run<?,?> parent) {
// Backward compatibility:
if (Util.isOverridden(BuildSelector.class, getClass(), "getBuild",
Job.class, EnvVars.class, BuildFilter.class)) {
Run<?,?> run = getBuild(job, env, filter);
return (run != null && filter.isSelectable(run, env)) ? run : null;
}
for (Run<?,?> run = job.getLastCompletedBuild(); run != null; run = run.getPreviousCompletedBuild())
if (isSelectable(run, env) && filter.isSelectable(run, env))
return run;
return null;
}
代码示例来源:origin: jenkinsci/email-ext-plugin
candidate = candidate.getPreviousCompletedBuild();
代码示例来源:origin: jenkinsci/email-ext-plugin
debug.send(" buildWhereATestStartedFailing: %d", buildWhereATestStartedFailing.getNumber());
buildsWithSuspects.add(buildWhereATestStartedFailing);
Run<?, ?> previousBuildToCheck = buildWhereATestStartedFailing.getPreviousCompletedBuild();
if (previousBuildToCheck != null) {
debug.send(" previousBuildToCheck: %d", previousBuildToCheck.getNumber());
debug.send(" previousResult was not better than FAILURE; adding to buildsWithSuspects; continuing search");
buildsWithSuspects.add(previousBuildToCheck);
previousBuildToCheck = previousBuildToCheck.getPreviousCompletedBuild();
if (previousBuildToCheck != null) {
debug.send(" previousBuildToCheck: %d", previousBuildToCheck.getNumber());
代码示例来源:origin: jenkinsci/workflow-multibranch-plugin
boolean previousHadStep = false;
if (previousAction == null) {
Run<?,?> previousRun = build.getPreviousCompletedBuild();
if (previousRun instanceof FlowExecutionOwner.Executable) {
代码示例来源:origin: org.jenkins-ci.plugins.workflow/workflow-multibranch
boolean previousHadStep = false;
if (previousAction == null) {
Run<?,?> previousRun = build.getPreviousCompletedBuild();
if (previousRun instanceof FlowExecutionOwner.Executable) {
内容来源于网络,如有侵权,请联系作者删除!