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

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

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

AbstractProject.getUpstreamProjects介绍

暂无

代码示例

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

/**
 * Gets the upstream builds of this build, which are the builds of the
 * upstream projects whose artifacts feed into this build.
 * @return empty if there is no {@link FingerprintAction} (even if there is an {@link Cause.UpstreamCause})
 * @see #getTransitiveUpstreamBuilds()
 */
public Map<AbstractProject,Integer> getUpstreamBuilds() {
  return _getUpstreamBuilds(getParent().getUpstreamProjects());
}

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

@Exported(name="upstreamProjects")
@Restricted(DoNotUse.class) // only for exporting
public List<AbstractProject> getUpstreamProjectsForApi() {
  List<AbstractProject> r = new ArrayList<>();
  for (AbstractProject p : getUpstreamProjects()) {
    if (p.hasPermission(Item.READ)) {
      r.add(p);
    }
  }
  return r;
}

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

/**
 * Returns only those upstream projects that defines {@link BuildTrigger} to this project.
 * This is a subset of {@link #getUpstreamProjects()}
 * <p>No longer used in the UI.
 * @return A List of upstream projects that has a {@link BuildTrigger} to this project.
 */
public final List<AbstractProject> getBuildTriggerUpstreamProjects() {
  ArrayList<AbstractProject> result = new ArrayList<AbstractProject>();
  for (AbstractProject<?,?> ap : getUpstreamProjects()) {
    BuildTrigger buildTrigger = ap.getPublishersList().get(BuildTrigger.class);
    if (buildTrigger != null)
      if (buildTrigger.getChildJobs(ap).contains(this))
        result.add(ap);
  }
  return result;
}

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

public void run() {
  SecurityContext oldContext = ACL.impersonate(ACL.SYSTEM);
  try {
    Set<AbstractProject> topLevelProjects = new HashSet<AbstractProject>();
    // Get all top-level projects
    LOGGER.fine("assembling top level projects");
    for (AbstractProject p : Jenkins.getInstance().allItems(AbstractProject.class))
      if (p.getUpstreamProjects().size() == 0) {
        LOGGER.fine("adding top level project " + p.getName());
        topLevelProjects.add(p);
      } else {
        LOGGER.fine("skipping project since not a top level project: " + p.getName());
      }
    populate(topLevelProjects);
    for (AbstractProject p : polledProjects) {
        LOGGER.fine("running project in correct dependency order: " + p.getName());
      runnable.run(p);
    }
  } finally {
    SecurityContextHolder.setContext(oldContext);
  }
}

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

public static List<AbstractProject> getStartUpstreams(AbstractProject project) {
  List<AbstractProject> upstreams = project.getUpstreamProjects();
  if (upstreams.isEmpty()) {
    return new ArrayList<>(Collections.singleton(project));
  } else {
    return getStartUpstreams(project, new ArrayList<>());
  }
}

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

private static List<AbstractProject> getStartUpstreams(AbstractProject project, List<AbstractProject> edges) {
  List<AbstractProject> upstreams = project.getUpstreamProjects();
  if (upstreams.isEmpty()) {
    edges.add(project);
    return edges;
  } else {
    List<AbstractProject> result = new ArrayList<>(edges);
    for (AbstractProject upstream : upstreams) {
      result = (getStartUpstreams(upstream, edges));
    }
    return result;
  }
}

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

@Exported(name="upstreamProjects")
@Restricted(DoNotUse.class) // only for exporting
public List<AbstractProject> getUpstreamProjectsForApi() {
  List<AbstractProject> r = new ArrayList<>();
  for (AbstractProject p : getUpstreamProjects()) {
    if (p.hasPermission(Item.READ)) {
      r.add(p);
    }
  }
  return r;
}

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

/**
 * Gets the upstream builds of this build, which are the builds of the
 * upstream projects whose artifacts feed into this build.
 * @return empty if there is no {@link FingerprintAction} (even if there is an {@link Cause.UpstreamCause})
 * @see #getTransitiveUpstreamBuilds()
 */
public Map<AbstractProject,Integer> getUpstreamBuilds() {
  return _getUpstreamBuilds(getParent().getUpstreamProjects());
}

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

/**
 * Gets the upstream builds of this build, which are the builds of the
 * upstream projects whose artifacts feed into this build.
 *
 * @see #getTransitiveUpstreamBuilds()
 */
public Map<AbstractProject,Integer> getUpstreamBuilds() {
  return _getUpstreamBuilds(getParent().getUpstreamProjects());
}

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

/**
 * Gets the upstream builds of this build, which are the builds of the
 * upstream projects whose artifacts feed into this build.
 *
 * @see #getTransitiveUpstreamBuilds()
 */
public Map<AbstractProject,Integer> getUpstreamBuilds() {
  return _getUpstreamBuilds(getParent().getUpstreamProjects());
}

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

/**
 * Gets the upstream builds of this build, which are the builds of the
 * upstream projects whose artifacts feed into this build.
 *
 * @see #getTransitiveUpstreamBuilds()
 */
public Map<AbstractProject,Integer> getUpstreamBuilds() {
  return _getUpstreamBuilds(getParent().getUpstreamProjects());
}

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

/**
 * Gets the upstream builds of this build, which are the builds of the
 * upstream projects whose artifacts feed into this build.
 *
 * @see #getTransitiveUpstreamBuilds()
 */
public Map<AbstractProject, Integer> getUpstreamBuilds() {
  return _getUpstreamBuilds(getParent().getUpstreamProjects());
}

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

/**
 * Returns only those upstream projects that defines {@link BuildTrigger} to this project.
 * This is a subset of {@link #getUpstreamProjects()}
 * <p>No longer used in the UI.
 * @return A List of upstream projects that has a {@link BuildTrigger} to this project.
 */
public final List<AbstractProject> getBuildTriggerUpstreamProjects() {
  ArrayList<AbstractProject> result = new ArrayList<AbstractProject>();
  for (AbstractProject<?,?> ap : getUpstreamProjects()) {
    BuildTrigger buildTrigger = ap.getPublishersList().get(BuildTrigger.class);
    if (buildTrigger != null)
      if (buildTrigger.getChildJobs(ap).contains(this))
        result.add(ap);
  }
  return result;
}

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

/**
 * Returns only those upstream projects that defines {@link BuildTrigger} to this project.
 * This is a subset of {@link #getUpstreamProjects()}
 *
 * @return A List of upstream projects that has a {@link BuildTrigger} to this project.
 */
public final List<AbstractProject> getBuildTriggerUpstreamProjects() {
  ArrayList<AbstractProject> result = new ArrayList<AbstractProject>();
  for (AbstractProject<?,?> ap : getUpstreamProjects()) {
    BuildTrigger buildTrigger = ap.getPublishersList().get(BuildTrigger.class);
    if (buildTrigger != null)
      if (buildTrigger.getChildProjects().contains(this))
        result.add(ap);
  }
  return result;
}

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

/**
 * Returns only those upstream projects that defines {@link BuildTrigger} to this project.
 * This is a subset of {@link #getUpstreamProjects()}
 *
 * @return A List of upstream projects that has a {@link BuildTrigger} to this project.
 */
public final List<AbstractProject> getBuildTriggerUpstreamProjects() {
  ArrayList<AbstractProject> result = new ArrayList<AbstractProject>();
  for (AbstractProject<?,?> ap : getUpstreamProjects()) {
    BuildTrigger buildTrigger = ap.getPublishersList().get(BuildTrigger.class);
    if (buildTrigger != null)
      if (buildTrigger.getChildProjects().contains(this))
        result.add(ap);
  }
  return result;
}

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

/**
 * Returns only those upstream projects that defines {@link BuildTrigger} to
 * this project. This is a subset of {@link #getUpstreamProjects()}
 *
 * @return A List of upstream projects that has a {@link BuildTrigger} to
 * this project.
 */
public final List<AbstractProject> getBuildTriggerUpstreamProjects() {
  ArrayList<AbstractProject> result = new ArrayList<AbstractProject>();
  for (AbstractProject<?, ?> ap : getUpstreamProjects()) {
    BuildTrigger buildTrigger = ap.getPublishersList().get(BuildTrigger.class);
    if (buildTrigger != null) {
      if (buildTrigger.getChildProjects().contains(this)) {
        result.add(ap);
      }
    }
  }
  return result;
}

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

/**
 * Returns only those upstream projects that defines {@link BuildTrigger} to
 * this project. This is a subset of {@link #getUpstreamProjects()}
 *
 * @return A List of upstream projects that has a {@link BuildTrigger} to
 * this project.
 */
public final List<AbstractProject> getBuildTriggerUpstreamProjects() {
  ArrayList<AbstractProject> result = new ArrayList<AbstractProject>();
  for (AbstractProject<?, ?> ap : getUpstreamProjects()) {
    BuildTrigger buildTrigger = ap.getPublishersList().get(BuildTrigger.class);
    if (buildTrigger != null) {
      if (buildTrigger.getChildProjects().contains(this)) {
        result.add(ap);
      }
    }
  }
  return result;
}

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

@Override
  public List<AbstractProject> getUpstreamManualTriggered(AbstractProject<?, ?> project) {
    List<AbstractProject> result = new ArrayList<>();
    List<AbstractProject> upstreamProjects = project.getUpstreamProjects();
    for (AbstractProject upstream : upstreamProjects) {
      @SuppressWarnings("unchecked")
      DescribableList<Publisher, Descriptor<Publisher>> upstreamPublishersLists = upstream.getPublishersList();
      for (Publisher upstreamPub : upstreamPublishersLists) {
        if (upstreamPub instanceof BuildPipelineTrigger) {
          String names = ((BuildPipelineTrigger) upstreamPub).getDownstreamProjectNames();
          if (ProjectUtil.getProjectList(names, project.getParent(), null).contains(project)) {
            result.add(upstream);
          }
        }
      }
    }
    return result;
  }
}

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

public boolean isManualTrigger(AbstractProject<?, ?> project) {
  List<AbstractProject> upstreamProjects = project.getUpstreamProjects();
  for (AbstractProject upstreamProject : upstreamProjects) {
    DescribableList<Publisher, Descriptor<Publisher>> upstreamPublishersLists =
        upstreamProject.getPublishersList();
    for (Publisher upstreamPub : upstreamPublishersLists) {
      if (upstreamPub instanceof BuildPipelineTrigger) {
        String names = ((BuildPipelineTrigger) upstreamPub).getDownstreamProjectNames();
        if (ProjectUtil.getProjectList(names, project.getParent(), null).contains(project)) {
          return true;
        }
      }
    }
  }
  return false;
}

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

@CheckForNull
public static ManualStep getManualStepAggregated(AbstractProject project, AbstractProject firstProject) {
  if (isManualTrigger(project)) {
    Map<String, String> versions = new HashMap<>();
    AbstractProject<?, ?> upstream = (AbstractProject<?, ?>) project.getUpstreamProjects().get(0);
    for (AbstractBuild build : upstream.getBuilds()) {
      AbstractBuild versionBuild = BuildUtil.getFirstUpstreamBuild(build, firstProject);
      if (versionBuild != null && !versions.containsKey(versionBuild.getDisplayName())) {
        versions.put(versionBuild.getDisplayName(), String.valueOf(versionBuild.getNumber()));
      }
    }
    if (versions.isEmpty()) {
      return new ManualStep(upstream.getName(), null, false, project.hasPermission(Item.BUILD), versions);
    }
    return new ManualStep(upstream.getName(), null, true, project.hasPermission(Item.BUILD), versions);
  }
  return null;
}

相关文章

微信公众号

最新文章

更多

AbstractProject类方法