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

Disable Empty new lines before and after ANSI Color Block #255

Open
296951 opened this issue Apr 20, 2023 · 8 comments
Open

Disable Empty new lines before and after ANSI Color Block #255

296951 opened this issue Apr 20, 2023 · 8 comments
Labels
bug ❓ Possibly an ansicolor plugin bug

Comments

@296951
Copy link

296951 commented Apr 20, 2023

What feature do you want to see added?

When I use the ansi color plugin I get an empty log line before and after EVERY ANSI color block in the log.

Is there a way to disable this?

image

The json block is one ansi color block.

The 4 individual lines are each an ansi color block

Notice all the new lines
Below is the same log section with color disabled:

image

Upstream changes

No response

@296951 296951 added the enhancement (release-drafter) label Apr 20, 2023
@dblock
Copy link
Member

dblock commented Apr 21, 2023

Looks like a bug, doesn't it? I would try to reproduce in a unit test next.

@dblock dblock added bug ❓ Possibly an ansicolor plugin bug and removed enhancement (release-drafter) labels Apr 21, 2023
@tszmytka
Copy link
Collaborator

The new lines are the main part of a workaround that allows ansicolor to have its work actually passed on to the log file in the presence of timestamper plugin.
Here's more info.

@296951
Copy link
Author

296951 commented May 24, 2023

Is there a way to change the behavior if timestamper is not being used? I still get extra lines even if it is not used.

@tszmytka
Copy link
Collaborator

Is there a way to change the behavior if timestamper is not being used? I still get extra lines even if it is not used.

The determining factor here is whether the other extension (timestamper) is installed, not if it's being used currently (there's no reliable way of checking that).

@lemeurherve
Copy link
Member

lemeurherve commented Aug 23, 2023

The determining factor here is whether the other extension (timestamper) is installed, not if it's being used currently (there's no reliable way of checking that).

TIL, bummer.

Could a global env var or a setting configurable on the controller by admins could be a way of controlling this as a workaround?

Or a coordinate fix like you suggested in #193 (comment)?

Will read more about it in the several linked issues... Interested as I'd like to get this plugin running properly on infra.ci.jenkins.io with timestamps activated globally without modifying every pipelines.

@hashar
Copy link

hashar commented Oct 5, 2023

With Ansicolor 0.7.5 I don't have any newlines added when the color map is set globally. If I enable it at the job level, the extra newline shows up.

Ansicolor 1.0.0 has:

Based on the description of #218, TERM was not set for the global config. I thus imagine this change adding TERM leads to the newlines to be inserted. But maybe it is unrelated.

There is also e603edc (released in Ansicolor 0.7.3) which apparently cause a newline to be added when there is a decorator timestamper.pipeline.GlobalDecorator or kubernetes.pipeline.SecretsMasker.

@lppedd
Copy link

lppedd commented Nov 17, 2023

@tszmytka was the way timestamper works ever fixed? I recall you mentioning that the root problem was indeed how timestamper uses the log.

@reubenavery
Copy link

I am experiencing the exact opposite of this behavior in ANSI Reset codes causing lines to drop the \r returns and run together instead.
2024-05-14 at 2 04 PM
2024-05-14 at 2 02 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug ❓ Possibly an ansicolor plugin bug
Projects
None yet
Development

No branches or pull requests

7 participants