private File getLastBuildReportDir() { if (project.getLastBuild() == null) { // no clover report links, until there is at least one build return null; } // backward compatibility // since 0.3 File reportDir = new File(project.getLastBuild().getRootDir(), "cloverphp"); if (reportDir.exists()) { return reportDir; } return project.getLastBuild().getRootDir(); }
private FilePath getWorkspaceReportDir() { AbstractBuild<?, ?> lb = project.getLastBuild(); if (lb == null) { return null; } FilePath workspace = lb.getWorkspace(); if (workspace == null) { return null; } return workspace.child(publisher.getReportDir()); }
/** * Returns the last Result that was successful. * * WARNING: this method is invoked dynamically from CloverProjectAction/floatingBox.jelly * * @return the last successful build result */ public CloverBuildAction getLastSuccessfulResult() { for (Build<?, ?> b = project.getLastBuild(); b != null; b = b.getPreviousBuild()) { if (b.getResult() == Result.FAILURE) { continue; } CloverBuildAction r = b.getAction(CloverBuildAction.class); if (r != null) { return r; } } return null; }
public DirectoryBrowserSupport doDynamic(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException, InterruptedException { if (publisher.isPublishHtmlReport()) { FilePath r = getWorkspaceReportDir(); if (exists(r, "index.html")) { return new DirectoryBrowserSupport( this, r, "Clover Html Report", "/cloverphp/clover.gif", false); } } File reportDir = getLastBuildReportDir(); if (reportDir == null || getDisplayName() == null) { throw new Failure(Messages.CloverProjectAction_InvalidConfiguration()); } if (new File(reportDir, "clover.xml").exists()) { if (project.getLastBuild() != null) { int buildNumber = project.getLastBuild().getNumber(); rsp.sendRedirect2("../" + buildNumber + "/cloverphp-report"); } } throw new Failure(Messages.CloverProjectAction_HTML_NoCloverReportFound()); }
private JenkowExecContext(Run r) { // TODO 8 is it possible that we have both JenkowActions? JenkowAction ja = r.getAction(JenkowAction.class); if (ja == null) ja = JenkowAction.findDeferredAction(r); if (ja != null){ execId = ja.getTaskExecId(); if (execId != null){ RuntimeService rtSvc = JenkowEngine.getEngine().getRuntimeService(); Object bpObj = rtSvc.getVariable(execId,"jenkow_build_parent"); Object bnObj = rtSvc.getVariable(execId,"jenkow_build_number"); if (bpObj instanceof String && bnObj instanceof Integer){ String parentJobName = (String)bpObj; int buildNum = ((Integer)bnObj).intValue(); TopLevelItem it = Jenkins.getInstance().getItem(parentJobName); if (it instanceof Project){ parentProj = (Project)it; Run build = parentProj.getLastBuild(); if (build != null){ if (build.getNumber() == buildNum){ buildNum = buildNum; log = BuildLoggerMap.get(parentJobName,buildNum); } } } } } } }