hudson.model.Run.getWhyKeepLog()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(10.5k)|赞(0)|评价(0)|浏览(92)

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

Run.getWhyKeepLog介绍

[英]If #isKeepLog() returns true, returns a human readable one-line string that explains why it's being kept.
[中]如果#isKeepLog()返回true,则返回一个人类可读的单行字符串,解释为什么要保留它。

代码示例

代码示例来源:origin: jenkinsci/jenkins

/**
 * Returns true if this log file should be kept and not deleted.
 *
 * This is used as a signal to the {@link BuildDiscarder}.
 */
@Exported
public final boolean isKeepLog() {
  return getWhyKeepLog()!=null;
}

代码示例来源:origin: jenkinsci/jenkins

/**
 * Deletes the build when the button is pressed.
 */
@RequirePOST
public void doDoDelete( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException {
  checkPermission(DELETE);
  // We should not simply delete the build if it has been explicitly
  // marked to be preserved, or if the build should not be deleted
  // due to dependencies!
  String why = getWhyKeepLog();
  if (why!=null) {
    sendError(Messages.Run_UnableToDelete(getFullDisplayName(), why), req, rsp);
    return;
  }
  try{
    delete();
  }
  catch(IOException ex){
    req.setAttribute("stackTraces", Functions.printThrowable(ex));
    req.getView(this, "delete-retry.jelly").forward(req, rsp);  
    return;
  }
  rsp.sendRedirect2(req.getContextPath()+'/' + getParent().getUrl());
}

代码示例来源:origin: jenkinsci/jenkins

@Override
public String getWhyKeepLog() {
  // if any of the downstream project is configured with 'keep dependency component',
  // we need to keep this log
  OUTER:
  for (AbstractProject<?,?> p : getParent().getDownstreamProjects()) {
    if (!p.isKeepDependencies()) continue;
    AbstractBuild<?,?> fb = p.getFirstBuild();
    if (fb==null)        continue; // no active record
    // is there any active build that depends on us?
    for (int i : getDownstreamRelationship(p).listNumbersReverse()) {
      // TODO: this is essentially a "find intersection between two sparse sequences"
      // and we should be able to do much better.
      if (i<fb.getNumber())
        continue OUTER; // all the other records are younger than the first record, so pointless to search.
      AbstractBuild<?,?> b = p.getBuildByNumber(i);
      if (b!=null)
        return Messages.AbstractBuild_KeptBecause(p.hasPermission(Item.READ) ? b.toString() : "?");
    }
  }
  return super.getWhyKeepLog();
}

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

public String superGetWhyKeepLog() {
  return super.getWhyKeepLog();
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

/**
 * Returns true if this log file should be kept and not deleted.
 *
 * This is used as a signal to the {@link BuildDiscarder}.
 */
@Exported
public final boolean isKeepLog() {
  return getWhyKeepLog()!=null;
}

代码示例来源:origin: org.eclipse.hudson/hudson-core

/**
 * Returns true if this log file should be kept and not deleted.
 *
 * This is used as a signal to the {@link LogRotator}.
 */
@Exported
public final boolean isKeepLog() {
  return getWhyKeepLog() != null;
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

/**
 * Returns true if this log file should be kept and not deleted.
 *
 * This is used as a signal to the {@link LogRotator}.
 */
@Exported
public final boolean isKeepLog() {
  return getWhyKeepLog()!=null;
}

代码示例来源:origin: hudson/hudson-2.x

/**
 * Returns true if this log file should be kept and not deleted.
 *
 * This is used as a signal to the {@link LogRotator}.
 */
@Exported
public final boolean isKeepLog() {
  return getWhyKeepLog()!=null;
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

/**
 * Returns true if this log file should be kept and not deleted.
 *
 * This is used as a signal to the {@link LogRotator}.
 */
@Exported
public final boolean isKeepLog() {
  return getWhyKeepLog()!=null;
}

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

@Override
public String getWhyKeepLog() {
  initPython();
  if (pexec.isImplemented(15)) {
    return (String) pexec.execPython("get_why_keep_log");
  } else {
    return super.getWhyKeepLog();
  }
}

代码示例来源:origin: hudson/hudson-2.x

/**
 * Deletes the build when the button is pressed.
 */
public void doDoDelete( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException {
  requirePOST();
  checkPermission(DELETE);
  // We should not simply delete the build if it has been explicitly
  // marked to be preserved, or if the build should not be deleted
  // due to dependencies!
  String why = getWhyKeepLog();
  if (why!=null) {
    sendError(Messages.Run_UnableToDelete(toString(),why),req,rsp);
    return;
  }
  delete();
  rsp.sendRedirect2(req.getContextPath()+'/' + getParent().getUrl());
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

@Override
public String getWhyKeepLog() {
  // if any of the downstream project is configured with 'keep dependency component',
  // we need to keep this log
  OUTER:
  for (AbstractProject<?,?> p : getParent().getDownstreamProjects()) {
    if (!p.isKeepDependencies()) continue;
    AbstractBuild<?,?> fb = p.getFirstBuild();
    if (fb==null)        continue; // no active record
    // is there any active build that depends on us?
    for (int i : getDownstreamRelationship(p).listNumbersReverse()) {
      // TODO: this is essentially a "find intersection between two sparse sequences"
      // and we should be able to do much better.
      if (i<fb.getNumber())
        continue OUTER; // all the other records are younger than the first record, so pointless to search.
      AbstractBuild<?,?> b = p.getBuildByNumber(i);
      if (b!=null)
        return Messages.AbstractBuild_KeptBecause(b);
    }
  }
  return super.getWhyKeepLog();
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

/**
 * Deletes the build when the button is pressed.
 */
public void doDoDelete( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException {
  requirePOST();
  checkPermission(DELETE);
  // We should not simply delete the build if it has been explicitly
  // marked to be preserved, or if the build should not be deleted
  // due to dependencies!
  String why = getWhyKeepLog();
  if (why!=null) {
    sendError(Messages.Run_UnableToDelete(toString(),why),req,rsp);
    return;
  }
  delete();
  rsp.sendRedirect2(req.getContextPath()+'/' + getParent().getUrl());
}

代码示例来源:origin: hudson/hudson-2.x

@Override
public String getWhyKeepLog() {
  // if any of the downstream project is configured with 'keep dependency component',
  // we need to keep this log
  OUTER:
  for (AbstractProject<?,?> p : getParent().getDownstreamProjects()) {
    if (!p.isKeepDependencies()) continue;
    AbstractBuild<?,?> fb = p.getFirstBuild();
    if (fb==null)        continue; // no active record
    // is there any active build that depends on us?
    for (int i : getDownstreamRelationship(p).listNumbersReverse()) {
      // TODO: this is essentially a "find intersection between two sparse sequences"
      // and we should be able to do much better.
      if (i<fb.getNumber())
        continue OUTER; // all the other records are younger than the first record, so pointless to search.
      AbstractBuild<?,?> b = p.getBuildByNumber(i);
      if (b!=null)
        return Messages.AbstractBuild_KeptBecause(b);
    }
  }
  return super.getWhyKeepLog();
}

代码示例来源:origin: org.eclipse.hudson/hudson-core

/**
 * Deletes the build when the button is pressed.
 */
public void doDoDelete(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
  requirePOST();
  checkPermission(DELETE);
  // We should not simply delete the build if it has been explicitly
  // marked to be preserved, or if the build should not be deleted
  // due to dependencies!
  String why = getWhyKeepLog();
  if (why != null) {
    sendError(Messages.Run_UnableToDelete(toString(), why), req, rsp);
    return;
  }
  delete();
  rsp.sendRedirect2(req.getContextPath() + '/' + getParent().getUrl());
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

/**
 * Deletes the build when the button is pressed.
 */
public void doDoDelete( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException {
  requirePOST();
  checkPermission(DELETE);
  // We should not simply delete the build if it has been explicitly
  // marked to be preserved, or if the build should not be deleted
  // due to dependencies!
  String why = getWhyKeepLog();
  if (why!=null) {
    sendError(Messages.Run_UnableToDelete(toString(),why),req,rsp);
    return;
  }
  delete();
  rsp.sendRedirect2(req.getContextPath()+'/' + getParent().getUrl());
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

@Override
public String getWhyKeepLog() {
  // if any of the downstream project is configured with 'keep dependency component',
  // we need to keep this log
  OUTER:
  for (AbstractProject<?,?> p : getParent().getDownstreamProjects()) {
    if (!p.isKeepDependencies()) continue;
    AbstractBuild<?,?> fb = p.getFirstBuild();
    if (fb==null)        continue; // no active record
    // is there any active build that depends on us?
    for (int i : getDownstreamRelationship(p).listNumbersReverse()) {
      // TODO: this is essentially a "find intersection between two sparse sequences"
      // and we should be able to do much better.
      if (i<fb.getNumber())
        continue OUTER; // all the other records are younger than the first record, so pointless to search.
      AbstractBuild<?,?> b = p.getBuildByNumber(i);
      if (b!=null)
        return Messages.AbstractBuild_KeptBecause(b);
    }
  }
  return super.getWhyKeepLog();
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

/**
 * Deletes the build when the button is pressed.
 */
@RequirePOST
public void doDoDelete( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException {
  checkPermission(DELETE);
  // We should not simply delete the build if it has been explicitly
  // marked to be preserved, or if the build should not be deleted
  // due to dependencies!
  String why = getWhyKeepLog();
  if (why!=null) {
    sendError(Messages.Run_UnableToDelete(getFullDisplayName(), why), req, rsp);
    return;
  }
  try{
    delete();
  }
  catch(IOException ex){
    req.setAttribute("stackTraces", Functions.printThrowable(ex));
    req.getView(this, "delete-retry.jelly").forward(req, rsp);  
    return;
  }
  rsp.sendRedirect2(req.getContextPath()+'/' + getParent().getUrl());
}

代码示例来源:origin: org.eclipse.hudson/hudson-core

@Override
public String getWhyKeepLog() {
  // if any of the downstream project is configured with 'keep dependency component',
  // we need to keep this log
  OUTER:
  for (AbstractProject<?, ?> p : getParent().getDownstreamProjects()) {
    if (!p.isKeepDependencies()) {
      continue;
    }
    AbstractBuild<?, ?> fb = p.getFirstBuild();
    if (fb == null) {
      continue; // no active record
    }
    // is there any active build that depends on us?
    for (int i : getDownstreamRelationship(p).listNumbersReverse()) {
      // TODO: this is essentially a "find intersection between two sparse sequences"
      // and we should be able to do much better.
      if (i < fb.getNumber()) {
        continue OUTER; // all the other records are younger than the first record, so pointless to search.
      }
      AbstractBuild<?, ?> b = p.getBuildByNumber(i);
      if (b != null) {
        return Messages.AbstractBuild_KeptBecause(b);
      }
    }
  }
  return super.getWhyKeepLog();
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

@Override
public String getWhyKeepLog() {
  // if any of the downstream project is configured with 'keep dependency component',
  // we need to keep this log
  OUTER:
  for (AbstractProject<?,?> p : getParent().getDownstreamProjects()) {
    if (!p.isKeepDependencies()) continue;
    AbstractBuild<?,?> fb = p.getFirstBuild();
    if (fb==null)        continue; // no active record
    // is there any active build that depends on us?
    for (int i : getDownstreamRelationship(p).listNumbersReverse()) {
      // TODO: this is essentially a "find intersection between two sparse sequences"
      // and we should be able to do much better.
      if (i<fb.getNumber())
        continue OUTER; // all the other records are younger than the first record, so pointless to search.
      AbstractBuild<?,?> b = p.getBuildByNumber(i);
      if (b!=null)
        return Messages.AbstractBuild_KeptBecause(p.hasPermission(Item.READ) ? b.toString() : "?");
    }
  }
  return super.getWhyKeepLog();
}

相关文章

微信公众号

最新文章

更多

Run类方法