private boolean isBuildExist(BuildProject buildProject, BuildInfo info) { BuildRunFilter filter = new BuildRunFilter(); filter.references.add(Long.toString(info.getBuildId())); filter.name.add(getBuildName(info)); filter.buildProjects.add(buildProject); Collection<BuildRun> buildRuns = config.getV1Instance().get().buildRuns(filter); return buildRuns != null && buildRuns.size() != 0; }
private static BuildRun createBuildRun(BuildProject buildProject, BuildInfo info) { // Generate the BuildRun instance to be saved to the recipient BuildRun run = buildProject.createBuildRun(getBuildName(info), new DB.DateTime(info.getStartTime())); run.setElapsed((double) info.getElapsedTime()); run.setReference(Long.toString(info.getBuildId())); run.getSource().setCurrentValue(getSourceName(info.isForced())); run.getStatus().setCurrentValue(getStatusName(info.isSuccessful())); if (info.hasChanges()) { run.setDescription(getModificationDescription(info.getChanges())); } run.save(); run.createLink("Build Report", info.getUrl(), true); return run; }