/** * @deprecated Use {@link #schedule(hudson.model.AbstractBuild, hudson.model.Job, int, java.util.List, hudson.model.TaskListener)} */ @Deprecated protected Future schedule(AbstractBuild<?, ?> build, Job project, List<Action> list) throws InterruptedException, IOException { return schedule(build, project, list, TaskListener.NULL); }
/** * @deprecated Use {@link #schedule(hudson.model.AbstractBuild, hudson.model.Job, java.util.List, hudson.model.TaskListener)} */ @CheckForNull @Deprecated protected Future schedule(AbstractBuild<?, ?> build, final Job project, int quietPeriod, List<Action> list) throws InterruptedException, IOException { return schedule(build, project, quietPeriod, list, TaskListener.NULL); }
@CheckForNull protected Future schedule(@Nonnull AbstractBuild<?, ?> build, @Nonnull Job project, @Nonnull List<Action> list, @Nonnull TaskListener listener) throws InterruptedException, IOException { if (project instanceof ParameterizedJobMixIn.ParameterizedJob) { return schedule(build, project, ((ParameterizedJobMixIn.ParameterizedJob) project).getQuietPeriod(), list, listener); } else { return schedule(build, project, 0, list, listener); } }
@Override protected Future schedule(AbstractBuild<?, ?> build, AbstractProject project, List<Action> list) throws InterruptedException, IOException { if (block!=null) { while (true) { // if we fail to add the item to the queue, wait and retry. // it also means we have to force quiet period = 0, or else it'll never leave the queue Future f = project.scheduleBuild2(0, new UpstreamCause((Run) build), list.toArray(new Action[list.size()])); //when a project is disabled or the configuration is not yet saved f will always be null and we'ure caught in a loop, therefore we need to check for it if (f!=null || (f==null && !project.isBuildable())){ return f; } Thread.sleep(1000); } } else { return super.schedule(build,project,list); } }
@Override protected Future schedule(AbstractBuild<?, ?> build, Job project, List<Action> list, TaskListener listener) throws InterruptedException, IOException { if (block!=null) { while (true) { // add DifferentiatingAction to make sure this doesn't get merged with something else, // which is most likely unintended. Might make sense to do it at BuildTriggerConfig for all. list = ImmutableList.<Action>builder().addAll(list).add(new DifferentiatingAction()).build(); // if we fail to add the item to the queue, wait and retry. // it also means we have to force quiet period = 0, or else it'll never leave the queue Future f = schedule(build, project, 0, list, listener); // When a project is disabled or the configuration is not yet saved f will always be null and we're caught in a loop, therefore we need to check for it if (f!=null || (f==null && !canBeScheduled(project))){ return f; } Thread.sleep(1000); } } else { return super.schedule(build,project,list,listener); } }
public ListMultimap<AbstractProject, Future<AbstractBuild>> perform2(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException { EnvVars env = build.getEnvironment(listener); env.overrideAll(build.getBuildVariables()); try { if (getCondition().isMet(build.getResult())) { ListMultimap<AbstractProject, Future<AbstractBuild>> futures = ArrayListMultimap.create(); for (List<AbstractBuildParameters> addConfigs : getDynamicBuildParameters(build, listener)) { List<Action> actions = getBaseActions(ImmutableList.<AbstractBuildParameters>builder().addAll(configs).addAll(addConfigs).build(), build, listener); for (AbstractProject project : getProjectList(build.getProject().getParent(),env)) { List<Action> list = getBuildActions(actions, project); futures.put(project, schedule(build, project, list)); } } return futures; } } catch (DontTriggerException e) { // don't trigger on this configuration } return ArrayListMultimap.create(); }
/** * Note that with Hudson 1.341, trigger should be using * {@link BuildTrigger#buildDependencyGraph(AbstractProject, hudson.model.DependencyGraph)}. */ public List<Future<AbstractBuild>> perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException { EnvVars env = build.getEnvironment(listener); env.overrideAll(build.getBuildVariables()); try { if (condition.isMet(build.getResult())) { List<Future<AbstractBuild>> futures = new ArrayList<Future<AbstractBuild>>(); for (List<AbstractBuildParameters> addConfigs : getDynamicBuildParameters(build, listener)) { List<Action> actions = getBaseActions( ImmutableList.<AbstractBuildParameters>builder().addAll(configs).addAll(addConfigs).build(), build, listener); for (AbstractProject project : getProjectList(build.getProject().getParent(),env)) { List<Action> list = getBuildActions(actions, project); futures.add(schedule(build, project, list)); } } return futures; } } catch (DontTriggerException e) { // don't trigger on this configuration } return Collections.emptyList(); }
public ListMultimap<Job, Future<Run>> perform3(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException { EnvVars env = build.getEnvironment(listener); env.overrideAll(build.getBuildVariables()); try { if (getCondition().isMet(build.getResult())) { ListMultimap<Job, Future<Run>> futures = ArrayListMultimap.create(); for (List<AbstractBuildParameters> addConfigs : getDynamicBuildParameters(build, listener)) { List<Action> actions = getBaseActions(ImmutableList.<AbstractBuildParameters>builder().addAll(configs).addAll(addConfigs).build(), build, listener); for (Job project : getJobs(build.getRootBuild().getProject().getParent(), env)) { List<Action> list = getBuildActions(actions, project); final Future scheduled = schedule(build, project, list, listener); if (scheduled != null) { futures.put(project, scheduled); } else { reportSchedulingError(build, project, listener); } } } return futures; } } catch (DontTriggerException e) { // don't trigger on this configuration } return ArrayListMultimap.create(); }
List<Action> list = getBuildActions(actions, project); future = schedule(build, project, list, listener); if (future != null) { futures.add(future);