hudson.model.AbstractProject.isInQueue()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(11.4k)|赞(0)|评价(0)|浏览(79)

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

AbstractProject.isInQueue介绍

[英]Returns true if the build is in the queue.
[中]如果生成在队列中,则返回true。

代码示例

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

? Messages.AbstractProject_WorkspaceOffline()
  : Messages.AbstractProject_NoWorkspace());
if (isInQueue()) {
  listener.getLogger().println(Messages.AbstractProject_AwaitingBuildForWorkspace());
  return NO_CHANGES;

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

if (lb==null) {
  listener.getLogger().println(Messages.AbstractProject_NoBuilds());
  return isInQueue() ? NO_CHANGES : BUILD_NOW;

代码示例来源:origin: org.hudsonci.plugins/instant-messaging

@Override
protected CharSequence getMessageForJob(AbstractProject<?, ?> project) {
  StringBuilder msg = new StringBuilder(32);
  msg.append(project.getFullDisplayName());
  if (project.isDisabled()) {
    msg.append("(disabled) ");
  // a project which is building and additionally in queue should be reported as building
  } else if (project.isBuilding()) {
    msg.append("(BUILDING: ").append(project.getLastBuild().getDurationString()).append(")");
  } else if (project.isInQueue()) {
    msg.append("(in queue) ");
  }
  msg.append(": ");
  AbstractBuild<?, ?> lastBuild = project.getLastBuild();
  while ((lastBuild != null) && lastBuild.isBuilding()) {
    lastBuild = lastBuild.getPreviousBuild();
  }
  if (lastBuild != null) {
    msg.append("last build: ").append(lastBuild.getNumber()).append(" (")
      .append(lastBuild.getTimestampString()).append(" ago): ").append(lastBuild.getResult()).append(": ")
      .append(MessageHelper.getBuildURL(lastBuild));
  } else {
    msg.append("no finished build yet");
  }
  return msg;
}

代码示例来源:origin: jenkinsci/instant-messaging-plugin

@Override
protected CharSequence getMessageForJob(AbstractProject<?, ?> project) {
  StringBuilder msg = new StringBuilder(32);
  msg.append(project.getFullDisplayName());
  if (project.isDisabled()) {
    msg.append("(disabled) ");
  // a project which is building and additionally in queue should be reported as building
  } else if (project.isBuilding()) {
    msg.append("(BUILDING: ").append(project.getLastBuild().getDurationString()).append(")");
  } else if (project.isInQueue()) {
    msg.append("(in queue) ");
  }
  msg.append(": ");
  AbstractBuild<?, ?> lastBuild = project.getLastBuild();
  while ((lastBuild != null) && lastBuild.isBuilding()) {
    lastBuild = lastBuild.getPreviousBuild();
  }
  if (lastBuild != null) {
    msg.append("last build: ").append(lastBuild.getNumber()).append(" (")
      .append(lastBuild.getTimestampString()).append(" ago): ").append(lastBuild.getResult()).append(": ")
      .append(MessageHelper.getBuildURL(lastBuild));
  } else {
    msg.append("no finished build yet");
  }
  return msg;
}

代码示例来源:origin: org.hudsonci.plugins/instant-messaging

} else if (project.isBuilding()) {
  msg.append("(BUILDING: ").append(project.getLastBuild().getDurationString()).append(")");
} else if (project.isInQueue()) {
  msg.append("(in queue)");

代码示例来源:origin: jenkinsci/instant-messaging-plugin

} else if (project.isBuilding()) {
  msg.append("(BUILDING: ").append(project.getLastBuild().getDurationString()).append(")");
} else if (project.isInQueue()) {
  msg.append("(in queue)");

代码示例来源:origin: org.hudsonci.plugins/ivy

/**
   * Determines whether any of the upstream project are either
   * building or in the queue.
   *
   * This means eventually there will be an automatic triggering of
   * the given project (provided that all builds went smoothly.)
   *
   * @param downstreamProject
   *      The AbstractProject we want to build.
   * @param excludeProject
   *      An AbstractProject to exclude - if we see this in the transitive
   *      dependencies, we're not going to bother checking to see if it's
   *      building. For example, pass the current parent project to be sure
   *      that it will be ignored when looking for building dependencies.
   * @return
   *      True if any upstream projects are building or in queue, false otherwise.
   */
  private boolean areUpstreamsBuilding(AbstractProject downstreamProject,
                          AbstractProject excludeProject) {
    DependencyGraph graph = Hudson.getInstance().getDependencyGraph();
    Set<AbstractProject> tups = graph.getTransitiveUpstream(downstreamProject);
    for (AbstractProject tup : tups) {
      if(tup!=excludeProject && (tup.isBuilding() || tup.isInQueue()))
        return true;
    }
    return false;
  }
}

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

/**
 * Determines whether any of the upstream project are either
 * building or in the queue.
 *
 * This means eventually there will be an automatic triggering of
 * the given project (provided that all builds went smoothly.)
 *
 * @param downstreamProject
 *      The AbstractProject we want to build.
 * @param excludeProject
 *      An AbstractProject to exclude - if we see this in the transitive
 *      dependencies, we're not going to bother checking to see if it's
 *      building. For example, pass the current parent project to be sure
 *      that it will be ignored when looking for building dependencies.
 * @return
 *      True if any upstream projects are building or in queue, false otherwise.
 */
private boolean areUpstreamsBuilding(AbstractProject<?,?> downstreamProject,
    AbstractProject<?,?> excludeProject) {
  DependencyGraph graph = Hudson.getInstance().getDependencyGraph();
  Set<AbstractProject> tups = graph.getTransitiveUpstream(downstreamProject);
  for (AbstractProject tup : tups) {
    if(tup!=excludeProject && (tup.isBuilding() || tup.isInQueue()))
      return true;
  }
  return false;
}

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

/**
   * Determines whether any of the upstream project are either
   * building or in the queue.
   *
   * This means eventually there will be an automatic triggering of
   * the given project (provided that all builds went smoothly.)
   *
   * @param downstreamProject
   *      The AbstractProject we want to build.
   * @param excludeProject
   *      An AbstractProject to exclude - if we see this in the transitive
   *      dependencies, we're not going to bother checking to see if it's
   *      building. For example, pass the current parent project to be sure
   *      that it will be ignored when looking for building dependencies.
   * @return
   *      True if any upstream projects are building or in queue, false otherwise.
   */
  private boolean areUpstreamsBuilding(AbstractProject downstreamProject,
                          AbstractProject excludeProject) {
    DependencyGraph graph = Hudson.getInstance().getDependencyGraph();
    Set<AbstractProject> tups = graph.getTransitiveUpstream(downstreamProject);
    for (AbstractProject tup : tups) {
      if(tup!=excludeProject && (tup.isBuilding() || tup.isInQueue()))
        return true;
    }
    return false;
  }
}

代码示例来源:origin: org.jvnet.hudson.plugins/ivy

/**
   * Determines whether any of the upstream project are either
   * building or in the queue.
   *
   * This means eventually there will be an automatic triggering of
   * the given project (provided that all builds went smoothly.)
   *
   * @param downstreamProject
   *      The AbstractProject we want to build.
   * @param excludeProject
   *      An AbstractProject to exclude - if we see this in the transitive
   *      dependencies, we're not going to bother checking to see if it's
   *      building. For example, pass the current parent project to be sure
   *      that it will be ignored when looking for building dependencies.
   * @return
   *      True if any upstream projects are building or in queue, false otherwise.
   */
  private boolean areUpstreamsBuilding(AbstractProject downstreamProject,
                          AbstractProject excludeProject) {
    DependencyGraph graph = Hudson.getInstance().getDependencyGraph();
    Set<AbstractProject> tups = graph.getTransitiveUpstream(downstreamProject);
    for (AbstractProject tup : tups) {
      if(tup!=excludeProject && (tup.isBuilding() || tup.isInQueue()))
        return true;
    }
    return false;
  }
}

代码示例来源:origin: jenkinsci/maven-plugin

Set<AbstractProject> tups = graph.getTransitiveUpstream(downstreamProject);
for (AbstractProject tup : tups) {
  if (tup != excludeProject && (tup.isBuilding() || tup.isInQueue())) {
    AbstractProject<?,?> tupr = tup.getRootProject();
    if (tupr instanceof MavenModuleSet && ((MavenModuleSet) tupr).getBlockTriggerWhenBuilding()) {

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

? Messages.AbstractProject_WorkspaceOffline()
  : Messages.AbstractProject_NoWorkspace());
if (isInQueue()) {
  listener.getLogger().println(Messages.AbstractProject_AwaitingBuildForWorkspace());
  return NO_CHANGES;

代码示例来源:origin: Diabol/delivery-pipeline-plugin

Component component) throws PipelineException {
List<Pipeline> result = new ArrayList<>();
if (firstProject.isInQueue()) {
  String pipeLineTimestamp = TimestampFormat.formatTimestamp(firstProject.getQueueItem().getInQueueSince());
  List<Stage> pipelineStages = new ArrayList<>();

代码示例来源:origin: org.jvnet.hudson.plugins/ivy

@Override
public CauseOfBlockage getCauseOfBlockage() {
  CauseOfBlockage cob = super.getCauseOfBlockage();
  if (cob != null)
    return cob;
  if (!getParent().isAggregatorStyleBuild()) {
    DependencyGraph graph = Hudson.getInstance().getDependencyGraph();
    for (AbstractProject tup : graph.getTransitiveUpstream(this)) {
      if(getParent() == tup.getParent() && (tup.isBuilding() || tup.isInQueue()))
          return new BecauseOfUpstreamModuleBuildInProgress(tup);
    }
  }
  return null;
}

代码示例来源:origin: Diabol/delivery-pipeline-plugin

public static boolean isQueued(AbstractProject project, AbstractBuild firstBuild) {
  if (!project.isInQueue()) {
    return false;
  } else if (firstBuild == null) {
    return true;
  }
  List<Cause.UpstreamCause> causes = Util.filter(project.getQueueItem().getCauses(),
      Cause.UpstreamCause.class);
  @SuppressWarnings("unchecked")
  List<AbstractProject<?,?>> upstreamProjects = project.getUpstreamProjects();
  for (AbstractProject<?, ?> upstreamProject : upstreamProjects) {
    AbstractBuild upstreamBuild = BuildUtil.match(upstreamProject.getBuilds(), firstBuild);
    if (upstreamBuild != null) {
      for (Cause.UpstreamCause upstreamCause : causes) {
        if (upstreamBuild.getNumber() == upstreamCause.getUpstreamBuild()
            && upstreamProject.getRelativeNameFrom(JenkinsUtil.getInstance()).equals(
            upstreamCause.getUpstreamProject())) {
          return true;
        }
      }
    }
  }
  return false;
}

代码示例来源:origin: org.hudsonci.plugins/instant-messaging

@Override
protected CharSequence getMessageForJob(AbstractProject<?, ?> project, Sender sender, String[] args) throws CommandException {
  if ( (project.isInQueue() == false) && (project.isBuilding() == false) ) {
    throw new CommandException(
        sender + ": how do you intend to abort a build that isn't building?");
  if (project.isInQueue()) {
    aborted = Hudson.getInstance().getQueue().cancel(project);

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

@Override
public CauseOfBlockage getCauseOfBlockage() {
  CauseOfBlockage cob = super.getCauseOfBlockage();
  if (cob != null)
    return cob;
  if (!getParent().isAggregatorStyleBuild()) {
    DependencyGraph graph = Hudson.getInstance().getDependencyGraph();
    for (AbstractProject tup : graph.getTransitiveUpstream(this)) {
      if(getParent() == tup.getParent() && (tup.isBuilding() || tup.isInQueue()))
          return new BecauseOfUpstreamModuleBuildInProgress(tup);
    }
  }
  return null;
}

代码示例来源:origin: org.hudsonci.plugins/ivy

@Override
public CauseOfBlockage getCauseOfBlockage() {
  CauseOfBlockage cob = super.getCauseOfBlockage();
  if (cob != null)
    return cob;
  if (!getParent().isAggregatorStyleBuild()) {
    DependencyGraph graph = Hudson.getInstance().getDependencyGraph();
    for (AbstractProject tup : graph.getTransitiveUpstream(this)) {
      if(getParent() == tup.getParent() && (tup.isBuilding() || tup.isInQueue()))
          return new BecauseOfUpstreamModuleBuildInProgress(tup);
    }
  }
  return null;
}

代码示例来源:origin: jenkinsci/instant-messaging-plugin

@Override
protected CharSequence getMessageForJob(AbstractProject<?, ?> project, Sender sender, String[] args) throws CommandException {
  if ( (project.isInQueue() == false) && (project.isBuilding() == false) ) {
    throw new CommandException(
        sender + ": how do you intend to abort a build that isn't building?");
  if (project.isInQueue()) {
    aborted = Hudson.getInstance().getQueue().cancel(project);

代码示例来源:origin: org.hudsonci.plugins/rest-plugin-api

target.setConfigurable(source.isConfigurable());
target.setConcurrent(source.isConcurrentBuild());
target.setQueued(source.isInQueue());

相关文章

微信公众号

最新文章

更多

AbstractProject类方法