hudson.model.Project.getLastBuild()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(3.1k)|赞(0)|评价(0)|浏览(108)

本文整理了Java中hudson.model.Project.getLastBuild()方法的一些代码示例,展示了Project.getLastBuild()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Project.getLastBuild()方法的具体详情如下:
包路径:hudson.model.Project
类名称:Project
方法名:getLastBuild

Project.getLastBuild介绍

暂无

代码示例

代码示例来源:origin: org.jenkins-ci.plugins/cloverphp

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();
}

代码示例来源:origin: org.jenkins-ci.plugins/cloverphp

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());
}

代码示例来源:origin: org.jenkins-ci.plugins/cloverphp

/**
 * 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;
}

代码示例来源:origin: org.jenkins-ci.plugins/cloverphp

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());
}

代码示例来源:origin: com.cisco.step.jenkins.plugins/jenkow-plugin

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);
            }
          }
        }
      }
    }
  }
}

相关文章