@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; }
mavenColorizerFilter); EnvironmentExpander envEx = EnvironmentExpander.merge(getContext().get(EnvironmentExpander.class), new ExpanderImpl(envOverride));
@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; }
/** * {@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 final boolean start() throws Exception { KeyMaterialFactory keyMaterialFactory = newKeyMaterialFactory(); KeyMaterial material = keyMaterialFactory.materialize(); getContext().newBodyInvoker(). withContext(EnvironmentExpander.merge(getContext().get(EnvironmentExpander.class), new Expander(material))). withCallback(new Callback(material)). start(); return false; }
@Override public boolean onStart(SessionManager sessionManager) throws Exception { sessionManager.start(); getContext().newBodyInvoker(). withContext(EnvironmentExpander.merge(getContext().get(EnvironmentExpander.class), new NamespaceExpander(session.getNamespace()))). withCallback(new SessionManagerStopCallback(sessionManager)). start(); return false; }
@Override public boolean onStart(SessionManager sessionManager) throws Exception { sessionManager.start(); getContext().newBodyInvoker(). withContext(EnvironmentExpander.merge(getContext().get(EnvironmentExpander.class), new NamespaceExpander(session.getNamespace()))). withCallback(new SessionManagerStopCallback(sessionManager)). 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; }
getContext().newBodyInvoker() .withContexts( EnvironmentExpander.merge(getContext().get(EnvironmentExpander.class), EnvironmentExpander.constant(Collections.singletonMap("WORKSPACE", workspace.getRemote()))), workspace)
@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(); }
@Override public boolean start() throws Exception { TaskListener listener = getContext().get(TaskListener.class); NamespaceAction namespaceAction = new NamespaceAction(getContext().get(Run.class)); sessionId = generateSessionId(); namespace = generateNamespaceId(step.getName(), step.getPrefix(), sessionId); client = getKubernetesClient(); isOpenshift = client.isAdaptable(OpenShiftClient.class); configuration = new DefaultConfigurationBuilder() .withNamespace(namespace) .withNamespaceLazyCreateEnabled(step.isNamespaceLazyCreateEnabled()) .withNamespaceDestroyEnabled(step.isNamespaceDestroyEnabled()) .withMasterUrl(client.getMasterUrl()) .build(); StreamLogger logger = new StreamLogger(listener.getLogger()); LabelProvider labelProvider = new MapLabelProvider(step.getLabels()); namespaceService = isOpenshift ? new OpenshiftNamespaceService.ImmutableOpenshiftNamespaceService(client, configuration, labelProvider, logger) : new DefaultNamespaceService.ImmutableNamespaceService(client, configuration, labelProvider, logger); if (!namespaceService.exists(namespace) && configuration.isNamespaceLazyCreateEnabled()) { namespaceService.create(namespace); } namespaceAction.push(namespace); getContext().newBodyInvoker(). withContext(EnvironmentExpander.merge(getContext().get(EnvironmentExpander.class), new NamespaceExpander(namespace))). withCallback(new NamespaceDestructionCallback(namespace, configuration, namespaceService, namespaceAction)). start(); return false; }
@Override public boolean start() throws Exception { TaskListener listener = getContext().get(TaskListener.class); NamespaceAction namespaceAction = new NamespaceAction(getContext().get(Run.class)); sessionId = generateSessionId(); namespace = generateNamespaceId(step.getName(), step.getPrefix(), sessionId); client = getKubernetesClient(); isOpenshift = client.isAdaptable(OpenShiftClient.class); configuration = new DefaultConfigurationBuilder() .withNamespace(namespace) .withNamespaceLazyCreateEnabled(step.isNamespaceLazyCreateEnabled()) .withNamespaceDestroyEnabled(step.isNamespaceDestroyEnabled()) .withMasterUrl(client.getMasterUrl()) .build(); StreamLogger logger = new StreamLogger(listener.getLogger()); LabelProvider labelProvider = new MapLabelProvider(step.getLabels()); namespaceService = isOpenshift ? new OpenshiftNamespaceService.ImmutableOpenshiftNamespaceService(client, configuration, labelProvider, logger) : new DefaultNamespaceService.ImmutableNamespaceService(client, configuration, labelProvider, logger); if (!namespaceService.exists(namespace) && configuration.isNamespaceLazyCreateEnabled()) { namespaceService.create(namespace); } namespaceAction.push(namespace); getContext().newBodyInvoker(). withContext(EnvironmentExpander.merge(getContext().get(EnvironmentExpander.class), new NamespaceExpander(namespace))). withCallback(new NamespaceDestructionCallback(namespace, configuration, namespaceService, namespaceAction)). start(); return false; }