Branch: refs/heads/master Home: https://github.com/jenkinsci/collapsing-console-sections-plugin Commit: acd325ca125feeb8cebd5ad6b051d9b6cd0c5571 https://github.com/jenkinsci/collapsing-console-sections-plugin/commit/acd325ca125feeb8cebd5ad6b051d9b6cd0c5571 Author: Antoine Musso <has...@free.fr> Date: 2019-12-03 (Tue, 03 Dec 2019)
Changed paths: M src/main/java/org/jvnet/hudson/plugins/collapsingconsolesections/CollapsingSectionAnnotator.java M src/main/java/org/jvnet/hudson/plugins/collapsingconsolesections/CollapsingSectionAnnotatorFactory.java Log Message: ----------- Better interaction with others ConsoleAnnotator When one also uses the ansicolor and/or timestamper plugins, the ConsoleAnnotator extension points have the same ordinal value (the default of 0). The annotation are thus processed in whatever order the plugins got registered. This patch fixes compatibility with both ansicolor and the timestamper plugins. ansicolor ========= With the ansicolor plugin, it will notice the collapsible section HTML and wraps it in an HTML comment. The HTML output ends up being broken. Given a message that starts with a green INFO: \033[32mINFO\033[0m:message And a collapsible section start set to: `.*message.*` When the section is processes before ansicolor, the output looks like: <!--<div class="section ...>\033[32m--> <span style="color: #00CD00;">INFO<!-- \033[0m --></span>:message Which is broken. The reason is the ansicolor plugin magically comments out the HTML element, considering it is a `<span>` it might have generated. The fix I have found is to have the collapsible section ConsoleAnnotator to act last, or at least after the ansicolor plugin which also has the default ordinal of 0. Setting CollapsingSectionAnnotatorFactory to an ordinal of -500 does the trick. timestamper =========== The timestamp is inserted before the HTML for the collapsible section and the output looks like: 00:00:00 [myjob] $ /bin/sh -xe /tmp/jenkins1234.sh 00:00:01 --------------------------------- Section title |Hide Details| --------------------------------- INFO:message 00:00:02 INFO:next message That happens regardless of the order in which the ConsoleAnnotator extension points are processed. I have found that in the timestamper plugin, its html is inserted as an end tag: text.addMarkup(0, 0, "", html); See for details: http://hudson.361315.n4.nabble.com/TimeStamper-interferes-with-ant-target-highlighting-td2399725.html https://github.com/jenkinsci/timestamper-plugin/commit/8211416d572e91a7baa5487c92c70dace0680547 That somehow causes the timestamp to always appear before the section HTML. Or to say it otherwise, the timestamper wraps the other tags. The timestamp thus appears out of the collapsible section. For the ansicolor compatibility, the collapsible section ConsoleAnnotator is made to have a lower ordinal it is thus processed after the timestamper. This patch change the markup to be inserted as an end tag, exactly like the timestamper plugin does. The collapsible section will thus wrap the timestamp as well: 00:00:00 [myjob] $ /bin/sh -xe /tmp/jenkins1234.sh --------------------------------- Section title |Hide Details| --------------------------------- 00:00:01 INFO:message 00:00:02 INFO:next message Note ==== One can inspect the ConsoleAnnotator order in the Jenkins script console using: i=1 Jenkins.instance.getExtensionList( hudson.console.ConsoleAnnotatorFactory.class ).each() { println("${i++} ${it}") } Example: 1 hudson.plugins.timestamper.annotator.TimestampAnnotatorFactory3@4182bbd6 2 hudson.console.UrlAnnotator@e50060d 3 hudson.plugins.ansicolor.ColorConsoleAnnotator$Factory@7978884d 4 hudson.plugins.timestamper.pipeline.GlobalAnnotator$Factory@7ee9e785 5 org.jvnet.hudson.plugins.collapsingconsolesections.CollapsingSectionAnnotatorFactory@2ae1bf85 Bug: https://phabricator.wikimedia.org/T236222 Bug: T236222 Commit: 3b30fc02658dfa65e4d50008f8b1e7d4f6ef6d2d https://github.com/jenkinsci/collapsing-console-sections-plugin/commit/3b30fc02658dfa65e4d50008f8b1e7d4f6ef6d2d Author: Oleg Nenashev <o.v.nenas...@gmail.com> Date: 2019-12-14 (Sat, 14 Dec 2019) Changed paths: M src/main/java/org/jvnet/hudson/plugins/collapsingconsolesections/CollapsingSectionAnnotator.java M src/main/java/org/jvnet/hudson/plugins/collapsingconsolesections/CollapsingSectionAnnotatorFactory.java Log Message: ----------- Merge pull request #18 from hashar/compat_ansicolor-timestamper Reduce the priority of the Collapsing Console Sections annotator so that it runs after other annotators and takes data injected by them into account Compare: https://github.com/jenkinsci/collapsing-console-sections-plugin/compare/785c8b2eb04b...3b30fc02658d -- You received this message because you are subscribed to the Google Groups "Jenkins Commits" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-commits+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-commits/jenkinsci/collapsing-console-sections-plugin/push/refs/heads/master/785c8b-3b30fc%40github.com.