Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DO NOT MERGE JENKINS-55318 support ansi-color plugin 0.6.x version #201

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion jenkins-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
</developers>

<properties>
<jenkins.version>2.145</jenkins.version><!-- for ansi-color 0.6.0 -->
<revision>3.6.6</revision>
<changelist>-SNAPSHOT</changelist>
<scm-api-plugin.version>2.2.6</scm-api-plugin.version>
Expand Down Expand Up @@ -103,6 +104,11 @@
<artifactId>HikariCP</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>ansicolor</artifactId>
<version>0.6.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-job</artifactId>
Expand Down Expand Up @@ -518,7 +524,7 @@
<dependency>
<groupId>org.kohsuke.stapler</groupId>
<artifactId>stapler</artifactId>
<version>1.254</version>
<version>1.254.1</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@
import hudson.model.Node;
import hudson.model.Run;
import hudson.model.TaskListener;
import hudson.plugins.ansicolor.AnsiColorConsoleLogFilter;
import hudson.plugins.ansicolor.AnsiColorMap;
import hudson.plugins.ansicolor.ColorizedAction;
import hudson.slaves.WorkspaceList;
import hudson.tasks.Maven;
import hudson.tasks.Maven.MavenInstallation;
Expand Down Expand Up @@ -222,11 +225,11 @@ protected boolean doStart() throws Exception {

ConsoleLogFilter originalFilter = getContext().get(ConsoleLogFilter.class);
ConsoleLogFilter maskSecretsFilter = MaskPasswordsConsoleLogFilter.newMaskPasswordsConsoleLogFilter(credentials, getComputer().getDefaultCharset());
MavenColorizerConsoleLogFilter mavenColorizerFilter = new MavenColorizerConsoleLogFilter(getComputer().getDefaultCharset().name());
//ConsoleLogFilter mavenColorizerFilter = new MavenColorizerConsoleLogFilter(getComputer().getDefaultCharset().name());

ConsoleLogFilter newFilter = BodyInvoker.mergeConsoleLogFilters(originalFilter, maskSecretsFilter);
build.replaceAction(new ColorizedAction(AnsiColorMap.DefaultName));

ConsoleLogFilter newFilter = BodyInvoker.mergeConsoleLogFilters(
BodyInvoker.mergeConsoleLogFilters(originalFilter, maskSecretsFilter),
mavenColorizerFilter);

EnvironmentExpander envEx = EnvironmentExpander.merge(getContext().get(EnvironmentExpander.class), new ExpanderImpl(envOverride));

Expand Down Expand Up @@ -357,6 +360,7 @@ private void setupMaven(@Nonnull Collection<Credentials> credentials) throws IOE
// MAVEN_CONFIG
StringBuilder mavenConfig = new StringBuilder();
mavenConfig.append("--batch-mode ");
mavenConfig.append("-Dstyle.color=always ");
mavenConfig.append("--show-version ");
if (StringUtils.isNotEmpty(settingsFilePath)) {
mavenConfig.append("--settings \"" + settingsFilePath + "\" ");
Expand Down