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

Trigger tailed log output colorization also after Jenkins restart #227

Merged
merged 4 commits into from
May 16, 2021

Conversation

tszmytka
Copy link
Collaborator

@tszmytka tszmytka commented May 15, 2021

Currently the functionality allowing tailed log output to be colorized is executed at the very end of a build - after the log file has already been closed (onFinalized). This permits accurate calculation of the point where tailed output will begin and correct ColorizedAction.Command.START action injection. Upon rendering, the new action gets added to the output but since the log file has already been closed the new content is not persisted. As a result tailed log output looks fine until a Jenkins instance gets rebooted. After the restart it gets shown without any ansi code interpreted (full output is fine before and after reboot).

The PR fixes this by moving the execution a bit earlier - to onCompleted. This point in the lifecycle of a WorkflowRun happens before log file has been closed so any log amendments get properly persisted and tailed log output gets correctly rendered before and after Jenkins restart. One drawback is that one final line gets added to the log after onCompleted so tailed output begin calculation needs to take that into consideration.
This change might also work for #216 but I can't be 100% sure as I haven't been able to reproduce that issue.

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your master branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Ensure you have provided tests - that demonstrates feature works or fixes the issue

@tszmytka tszmytka changed the title Retain coloring on restart Trigger tailed log output colorization also after Jenkins restart May 15, 2021
@tszmytka tszmytka marked this pull request as ready for review May 15, 2021 15:25
@tszmytka tszmytka added the bugfix (release-drafter) label May 15, 2021
@tszmytka
Copy link
Collaborator Author

When this gets merged I think it will be high time to release a new version and with that I would like to propose bumping the version to a full 1.0.0 to indicate the project's well-above-infancy status.

Function-wise ansicolor-plugin has been stable for a long period of time covering at least most of the use-cases. Personally I think this bump could have been easily made years ago.

Keeping the version on a pre-1.0 level doesn't reflect the real maturity of the project and may very well discourage potential users from installing it (Why is the version < 1.0? Is it in a beta state? Maybe it is in experimental shape and not really recommended for real-world use yet?).

@dblock dblock merged commit c4984f1 into jenkinsci:master May 16, 2021
@tszmytka tszmytka deleted the retain-coloring-on-restart branch May 16, 2021 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix (release-drafter)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants