本文整理汇总了Java中hudson.console.ConsoleLogFilter类的典型用法代码示例。如果您正苦于以下问题:Java ConsoleLogFilter类的具体用法?Java ConsoleLogFilter怎么用?Java ConsoleLogFilter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConsoleLogFilter类属于hudson.console包,在下文中一共展示了ConsoleLogFilter类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: start
import hudson.console.ConsoleLogFilter; //导入依赖的package包/类
@Override public boolean start() 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 Callback(disposer) : BodyExecutionCallback.wrap(getContext())).start();
return false;
}
示例2: start
import hudson.console.ConsoleLogFilter; //导入依赖的package包/类
@Override public boolean start() throws Exception {
Run<?,?> run = getContext().get(Run.class);
TaskListener listener = getContext().get(TaskListener.class);
FilePath workspace = getContext().get(FilePath.class);
Launcher launcher = getContext().get(Launcher.class);
Map<String,String> overrides = new HashMap<String,String>();
List<MultiBinding.Unbinder> unbinders = new ArrayList<MultiBinding.Unbinder>();
for (MultiBinding<?> binding : step.bindings) {
if (binding.getDescriptor().requiresWorkspace() &&
(workspace == null || launcher == null)) {
throw new MissingContextVariableException(FilePath.class);
}
MultiBinding.MultiEnvironment environment = binding.bind(run, workspace, launcher, listener);
unbinders.add(environment.getUnbinder());
overrides.putAll(environment.getValues());
}
getContext().newBodyInvoker().
withContext(EnvironmentExpander.merge(getContext().get(EnvironmentExpander.class), new Overrider(overrides))).
withContext(BodyInvoker.mergeConsoleLogFilters(getContext().get(ConsoleLogFilter.class), new Filter(overrides.values(), run.getCharset().name()))).
withCallback(new Callback(unbinders)).
start();
return false;
}
示例3: start
import hudson.console.ConsoleLogFilter; //导入依赖的package包/类
@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;
}
示例4: createLoggerDecorator
import hudson.console.ConsoleLogFilter; //导入依赖的package包/类
@Override public ConsoleLogFilter createLoggerDecorator(Run<?,?> build) {
return new UpcaseFilter();
}
示例5: start
import hudson.console.ConsoleLogFilter; //导入依赖的package包/类
@Override
public boolean start() throws Exception {
envOverride = new EnvVars();
console = listener.getLogger();
if (LOGGER.isLoggable(Level.FINE)) {
LOGGER.log(Level.FINE, "Maven: {0}", step.getMaven());
LOGGER.log(Level.FINE, "Jdk: {0}", step.getJdk());
LOGGER.log(Level.FINE, "MavenOpts: {0}", step.getMavenOpts());
LOGGER.log(Level.FINE, "Settings Config: {0}", step.getMavenSettingsConfig());
LOGGER.log(Level.FINE, "Settings FilePath: {0}", step.getMavenSettingsFilePath());
LOGGER.log(Level.FINE, "Global settings Config: {0}", step.getGlobalMavenSettingsConfig());
LOGGER.log(Level.FINE, "Global settings FilePath: {0}", step.getGlobalMavenSettingsFilePath());
LOGGER.log(Level.FINE, "Options: {0}", step.getOptions());
LOGGER.log(Level.FINE, "env.PATH: {0}", env.get("PATH")); // JENKINS-40484
LOGGER.log(Level.FINE, "ws: {0}", ws.getRemote()); // JENKINS-47804
}
listener.getLogger().println("[withMaven] Options: " + step.getOptions());
ExtensionList<MavenPublisher> availableMavenPublishers = Jenkins.getInstance().getExtensionList(MavenPublisher.class);
listener.getLogger().println("[withMaven] Available options: " + Joiner.on(",").join(availableMavenPublishers));
getComputer();
withContainer = detectWithContainer();
if (withContainer) {
listener.getLogger().println("[withMaven] WARNING: \"withMaven(){...}\" step running within \"docker.image('image').inside {...}\"." +
" Since the Docker Pipeline Plugin version 1.14, you MUST:");
listener.getLogger().println("[withMaven] * Either prepend the 'MVN_CMD_DIR' environment variable" +
" to the 'PATH' environment variable in every 'sh' step that invokes 'mvn' (e.g. \"sh \'export PATH=$MVN_CMD_DIR:$PATH && mvn clean deploy\' \"). ");
listener.getLogger().print("[withMaven] * Or use ");
listener.hyperlink("https://github.com/takari/maven-wrapper", "Takari's Maven Wrapper");
listener.getLogger().println(" (e.g. \"sh './mvnw clean deploy'\")");
listener.getLogger().print("[withMaven] See ");
listener.hyperlink("https://wiki.jenkins.io/display/JENKINS/Pipeline+Maven+Plugin#PipelineMavenPlugin-HowtousethePipelineMavenPluginwithDocker", "Pipeline Maven Plugin FAQ");
listener.getLogger().println(".");
}
setupJDK();
// list of credentials injected by withMaven. They will be tracked and masked in the logs
Collection<Credentials> credentials = new ArrayList<>();
setupMaven(credentials);
if (LOGGER.isLoggable(Level.FINE)) {
LOGGER.log(Level.FINE, this.build + " - Track usage and mask password of credentials " + Joiner.on(", ").join(Collections2.transform(credentials, new CredentialsToPrettyString())));
}
CredentialsProvider.trackAll(build, new ArrayList<>(credentials));
ConsoleLogFilter originalFilter = getContext().get(ConsoleLogFilter.class);
ConsoleLogFilter maskSecretsFilter = MaskPasswordsConsoleLogFilter.newMaskPasswordsConsoleLogFilter(credentials, getComputer().getDefaultCharset());
MavenColorizerConsoleLogFilter mavenColorizerFilter = new MavenColorizerConsoleLogFilter(getComputer().getDefaultCharset().name());
ConsoleLogFilter newFilter = BodyInvoker.mergeConsoleLogFilters(
BodyInvoker.mergeConsoleLogFilters(originalFilter, maskSecretsFilter),
mavenColorizerFilter);
EnvironmentExpander envEx = EnvironmentExpander.merge(getContext().get(EnvironmentExpander.class), new ExpanderImpl(envOverride));
LOGGER.log(Level.FINEST, "envOverride: {0}", envOverride); // JENKINS-40484
body = getContext().newBodyInvoker().withContexts(envEx, newFilter).withCallback(new WorkspaceCleanupCallback(tempBinDir, step.getOptions())).start();
return false;
}