/** * @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)); }
/** * @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)); }
@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 boolean start() throws Exception { getContext().newBodyInvoker() .withCallback(BodyExecutionCallback.wrap(getContext())) .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; }
/** * {@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; }
/** * {@inheritDoc} */ @Override public boolean start() throws Exception { StepContext context = getContext(); context.get(Run.class).replaceAction(new ColorizedAction(colorMapName)); EnvironmentExpander currentEnvironment = context.get(EnvironmentExpander.class); EnvironmentExpander terminalEnvironment = EnvironmentExpander.constant(Collections.singletonMap("TERM", colorMapName)); context.newBodyInvoker() .withContext(EnvironmentExpander.merge(currentEnvironment, terminalEnvironment)) .withCallback(BodyExecutionCallback.wrap(context)).start(); return false; }
@Override public boolean start() throws Exception { listener.getLogger().println("wrapping in a " + step.curve.getDescription()); getContext().newBodyInvoker().withCallback(BodyExecutionCallback.wrap(getContext())).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 { body = getContext().newBodyInvoker().withCallback(BodyExecutionCallback.wrap(getContext())).start(); return false; } @Override public void stop(Throwable cause) throws Exception {
@Override public boolean start() throws Exception { getContext().newBodyInvoker().withCallback(BodyExecutionCallback.wrap(getContext())).start(); return false; } }
body = getContext().newBodyInvoker() .withContext(workspace) .withCallback(BodyExecutionCallback.wrap(getContext())) .start(); return false;
@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 { 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 }
@Override public boolean start() throws Exception { CpsStepContext cps = (CpsStepContext) getContext(); CpsThread t = CpsThread.current(); CpsFlowExecution execution = t.getExecution(); String text = cwd.child(step.getPath()).readToString(); String clazz = execution.getNextScriptName(step.getPath()); String newText = ReplayAction.replace(execution, clazz); if (newText != null) { listener.getLogger().println("Replacing Groovy text with edited version"); text = newText; } Script script; try { script = execution.getShell().parse(text); } catch (MultipleCompilationErrorsException e) { // Convert to a serializable exception, see JENKINS-40109. throw new CpsCompilationErrorsException(e); } // execute body as another thread that shares the same head as this thread // as the body can pause. cps.newBodyInvoker(t.getGroup().export(script)) .withDisplayName(step.getPath()) .withCallback(BodyExecutionCallback.wrap(cps)) .start(); // when the body is done, the load step is done return false; }
@Override public boolean start() throws Exception { Closure body = ScriptBytecodeAdapter.getMethodPointer(this, "bodyBlock"); CpsStepContext cps = (CpsStepContext) getContext(); CpsThread t = CpsThread.current(); cps.newBodyInvoker(t.getGroup().export(body)) .withCallback(BodyExecutionCallback.wrap(cps)) .start(); return false; } }
@Override public boolean start() throws Exception { StepContext context = getContext(); value = "one"; context.newBodyInvoker(). withContexts(EnvironmentExpander.merge(context.get(EnvironmentExpander.class), new ExpanderImpl(this))). withCallback(BodyExecutionCallback.wrap(context)). start(); return false; } @Override public void onResume() {
@Override public boolean start() throws Exception { final EnvVars awsEnv = new EnvVars(); this.withCredentials(this.getContext().get(Run.class), awsEnv); this.withProfile(awsEnv); this.withRegion(awsEnv); this.withEndpointUrl(awsEnv); this.withRole(awsEnv); this.withFederatedUserId(awsEnv); EnvironmentExpander expander = new EnvironmentExpander() { @Override public void expand(@Nonnull EnvVars envVars) { envVars.overrideAll(awsEnv); } }; this.getContext().newBodyInvoker() .withContext(EnvironmentExpander.merge(this.getContext().get(EnvironmentExpander.class), expander)) .withCallback(BodyExecutionCallback.wrap(this.getContext())) .start(); return false; }
private void doStart() throws Exception { SimpleBuildWrapper.Context c = new SimpleBuildWrapper.Context(); Run<?, ?> run = getContext().get(Run.class); delegate.setUp(c, run, getContext().get(FilePath.class), getContext().get(Launcher.class), getContext().get(TaskListener.class), getContext().get(EnvVars.class)); BodyInvoker bodyInvoker = getContext().newBodyInvoker(); Map<String,String> overrides = c.getEnv(); if (!overrides.isEmpty()) { bodyInvoker.withContext(EnvironmentExpander.merge(getContext().get(EnvironmentExpander.class), new ExpanderImpl(overrides))); } ConsoleLogFilter filter = delegate.createLoggerDecorator(run); if (filter != null) { bodyInvoker.withContext(BodyInvoker.mergeConsoleLogFilters(getContext().get(ConsoleLogFilter.class), filter)); } SimpleBuildWrapper.Disposer disposer = c.getDisposer(); bodyInvoker.withCallback(disposer != null ? new Callback2(disposer) : BodyExecutionCallback.wrap(getContext())).start(); }