Refine search
@Override public boolean start() throws Exception { final String name = StringUtils.isEmpty(step.name) ? "jenkins" : step.name; body = getContext().newBodyInvoker() .withCallback(new BodyExecutionCallback() { @Override public void onStart(StepContext context) { CommitStatusUpdater.updateCommitStatus(run, getTaskListener(context), BuildState.running, name, step.builds, step.connection); PendingBuildsAction action = run.getAction(PendingBuildsAction.class); if (action != null) { action.startBuild(name); } } @Override public void onSuccess(StepContext context, Object result) { CommitStatusUpdater.updateCommitStatus(run, getTaskListener(context), BuildState.success, name, step.builds, step.connection); context.onSuccess(result); } @Override public void onFailure(StepContext context, Throwable t) { BuildState state = t instanceof FlowInterruptedException ? BuildState.canceled : BuildState.failed; CommitStatusUpdater.updateCommitStatus(run, getTaskListener(context), state, name, step.builds, step.connection); context.onFailure(t); } }) .start(); return false; }
@Override public boolean start() throws Exception { StepContext context = getContext(); if (obj instanceof ConsoleLogFilter) { obj = BodyInvoker.mergeConsoleLogFilters(context.get(ConsoleLogFilter.class), (ConsoleLogFilter) obj); } else if (obj instanceof LauncherDecorator) { obj = BodyInvoker.mergeLauncherDecorators(context.get(LauncherDecorator.class), (LauncherDecorator) obj); } else if (obj instanceof EnvironmentExpander) { obj = EnvironmentExpander.merge(context.get(EnvironmentExpander.class), (EnvironmentExpander) obj); } context.newBodyInvoker().withContext(obj).withCallback(BodyExecutionCallback.wrap(context)).start(); return false; }
@Override public boolean start() throws Exception { if (getContext().hasBody()) { // recommended mode if (step.concurrency != null) { throw new AbortException(Messages.StageStepExecution_concurrency_not_supported_in_block_mode()); } getContext().newBodyInvoker().withCallback(BodyExecutionCallback.wrap(getContext())).withDisplayName(step.name).start(); return false; } getContext().get(TaskListener.class).getLogger().println(Messages.StageStepExecution_non_block_mode_deprecated()); if (isInsideParallel(node)) { throw new AbortException(Messages.StageStepExecution_the_stage_step_must_not_be_used_inside_a()); } node.addAction(new LabelAction(step.name)); node.addAction(new StageActionImpl(step.name)); enter(run, getContext(), step.name, step.concurrency); return false; // execute asynchronously }
filePath.mkdirs(); getContext().saveState(); listener.getLogger().println("Entering watch"); bos.flush(); Object o = getContext().newBodyInvoker().start().get(); getContext().onFailure(tie); return null; } catch (Throwable t) {
private ConsoleLogFilter createConsoleLogFilter(StepContext context) throws IOException, InterruptedException { ConsoleLogFilter original = context.get(ConsoleLogFilter.class); ConsoleLogFilter subsequent = new AnsiColorConsoleLogFilter(step.getColorMap()); return BodyInvoker.mergeConsoleLogFilters(original, subsequent); }
/** * @deprecated Use {@link #withCallback(BodyExecutionCallback)} and call {@link BodyExecutionCallback#wrap} if this is what you really wanted. */ public final BodyInvoker withCallback(FutureCallback<Object> callback) { return withCallback(BodyExecutionCallback.wrap(callback)); }
/** * Equivalent to calling {@link withContext} on each object. */ public BodyInvoker withContexts(Collection<?> overrides) { for (Object o : overrides) withContext(o); return this; }
/** * Equivalent to calling {@link withContext} on each object. */ public BodyInvoker withContexts(Object... overrides) { return withContexts(Arrays.asList(overrides)); }
@Override public boolean start() throws Exception { StepContext context = getContext(); sockets = new ArrayList<String>(); initRemoteAgent(); context.newBodyInvoker(). withContext(EnvironmentExpander.merge(getContext().get(EnvironmentExpander.class), new ExpanderImpl(this))). withCallback(new Callback(this)).withDisplayName(null).start(); return false; }
/** * @deprecated Use {@link #withCallback(BodyExecutionCallback)} and call {@link BodyExecutionCallback#wrap} if this is what you really wanted. */ public final BodyInvoker withCallback(FutureCallback<Object> callback) { return withCallback(BodyExecutionCallback.wrap(callback)); }
/** * Equivalent to calling {@link withContext} on each object. */ public BodyInvoker withContexts(Collection<?> overrides) { for (Object o : overrides) withContext(o); return this; }
/** * Equivalent to calling {@link withContext} on each object. */ public BodyInvoker withContexts(Object... overrides) { return withContexts(Arrays.asList(overrides)); }
/** * {@inheritDoc} */ @Override public boolean start() throws Exception { StepContext context = getContext(); EnvironmentExpander currentEnvironment = context.get(EnvironmentExpander.class); EnvironmentExpander terminalEnvironment = EnvironmentExpander.constant(Collections.singletonMap("TERM", step.getColorMapName())); context.newBodyInvoker().withContext(createConsoleLogFilter(context)) .withContext(EnvironmentExpander.merge(currentEnvironment, terminalEnvironment)) .withCallback(BodyExecutionCallback.wrap(context)).start(); return false; }
@Override public boolean start() throws Exception { body = getContext().newBodyInvoker() .withCallback(new BodyExecutionCallback() { @Override public void onStart(StepContext context) { .start(); return false;
@Override public boolean start() throws Exception { FilePath dir = getContext().get(FilePath.class).child(path); getContext().get(TaskListener.class).getLogger().println("Running in " + dir); getContext().newBodyInvoker() .withContext(dir) // Could use a dedicated BodyExecutionCallback here if we wished to print a message at the end ("Returning to ${cwd}"): .withCallback(BodyExecutionCallback.wrap(getContext())) .start(); return false; }
@Override public void onResume() { recurrencePeriod = MIN_RECURRENCE_PERIOD; if (body == null) { // Restarted while waiting for the timer to go off. Rerun now. body = getContext().newBodyInvoker().withCallback(new Callback(id)).start(); } // otherwise we are in the middle of the body already, so let it run }
@Override public boolean start() throws Exception { FilePath f = getContext().get(FilePath.class).child(file); getContext().newBodyInvoker(). withContext(BodyInvoker.mergeConsoleLogFilters(getContext().get(ConsoleLogFilter.class), new TeeFilter(f))). withCallback(BodyExecutionCallback.wrap(getContext())). start(); return false; }
@Override public boolean start() throws Exception { StepContext context = getContext(); context.newBodyInvoker() .withCallback(new Callback()) .start(); return false; }
@Override public boolean start() throws Exception { Map<String, String> overridesM = new HashMap<>(); for (String pair : overrides) { int split = pair.indexOf('='); assert split != -1; overridesM.put(pair.substring(0, split), pair.substring(split + 1)); } getContext().newBodyInvoker(). withContext(EnvironmentExpander.merge(getContext().get(EnvironmentExpander.class), EnvironmentExpander.constant(overridesM))). withCallback(BodyExecutionCallback.wrap(getContext())). start(); return false; }
@Override public void run() { task = null; body = getContext().newBodyInvoker().withCallback(new Callback(id)).start(); } }, recurrencePeriod, TimeUnit.MILLISECONDS);