public static void add(AbstractProject upstream, AbstractProject downstream, BuildTriggerConfig config, DependencyGraph graph) { // Keeping graph.addDependency() call in this class so classloader // won't look for DependencyGraph.Dependency when running on older Hudson graph.addDependency(new ParameterizedDependency(upstream, downstream, config)); }
@Override public boolean equals(Object obj) { if (obj == null) return false; if (getClass() != obj.getClass()) return false; final ParameterizedDependency that = (ParameterizedDependency) obj; return this.getUpstreamProject() == that.getUpstreamProject() || this.getDownstreamProject() == that.getDownstreamProject() || this.config == that.config; }
public void buildDependencyGraph(AbstractProject owner, DependencyGraph graph) { // Can only add dependencies in Hudson 1.341 or higher if (!canDeclare(owner)) return; for (BuildTriggerConfig config : configs) for (AbstractProject project : config.getProjectList(owner.getParent(),null)) ParameterizedDependency.add(owner, project, config, graph); } }
if (!BuildTriggerConfig.canTriggerProject(build, getDownstreamProject(), listener)) { return false; List<Action> actionList = config.getBaseActions(build, listener); if (!actionList.isEmpty()) { actions.addAll(config.getBuildActions(actionList, getDownstreamProject())); return true; } catch (Exception ex) { listener.error("Failed to build parameters to trigger project: " + getDownstreamProject().getName()); ex.printStackTrace(listener.getLogger()); return false;
@Override public void buildDependencyGraph(AbstractProject owner, DependencyGraph graph) { if (!canDeclare(owner)) return; for (BuildTriggerConfig config : configs) { List<AbstractProject> projectList = config.getProjectList(owner.getParent(), null); for (AbstractProject project : projectList) { if (config.isTriggerFromChildProjects() && owner instanceof ItemGroup) { ItemGroup<Item> parent = (ItemGroup) owner; for (Item item : parent.getItems()) { if(item instanceof AbstractProject){ AbstractProject child = (AbstractProject) item; ParameterizedDependency.add(child, project, config, graph); } } } else{ ParameterizedDependency.add(owner, project, config, graph); } } } }
@Override public boolean shouldTriggerBuild(AbstractBuild build, TaskListener listener, List<Action> actions) { if (!config.getCondition().isMet(build.getResult())){ return false; } try { List<Action> actionList = config.getBaseActions(build, listener); if (!actionList.isEmpty()) { actions.addAll(config.getBuildActions(actionList, getDownstreamProject())); return true; } if (config.getTriggerWithNoParameters()) { return true; } listener.getLogger().println("[parameterized-trigger] Downstream builds will not be triggered as no parameter is set."); return false; } catch (AbstractBuildParameters.DontTriggerException ex) { // don't trigger on this configuration return false; } catch (Exception ex) { listener.error("Failed to build parameters to trigger project: " + getDownstreamProject().getName()); ex.printStackTrace(listener.getLogger()); return false; } } }
@Override public boolean equals(Object obj) { if (obj == null) return false; if (getClass() != obj.getClass()) return false; final ParameterizedDependency that = (ParameterizedDependency) obj; return this.getUpstreamProject() == that.getUpstreamProject() || this.getDownstreamProject() == that.getDownstreamProject() || this.config == that.config; }
public static void add(AbstractProject upstream, AbstractProject downstream, BuildTriggerConfig config, DependencyGraph graph) { // Keeping graph.addDependency() call in this class so classloader // won't look for DependencyGraph.Dependency when running on older Hudson graph.addDependency(new ParameterizedDependency(upstream, downstream, config)); }
@Override public int hashCode() { int hash = 7; hash = 23 * hash + this.getUpstreamProject().hashCode(); hash = 23 * hash + this.getDownstreamProject().hashCode(); hash = 23 * hash + this.config.hashCode(); return hash; }
@Override public int hashCode() { int hash = 7; hash = 23 * hash + this.getUpstreamProject().hashCode(); hash = 23 * hash + this.getDownstreamProject().hashCode(); hash = 23 * hash + this.config.hashCode(); return hash; }