Stream HTML console log#11177
Conversation
…arge-text-interface
This will avoid high churn of buffers when resetting the line buffer at the end of each line and processing long log lines.
Increase buffer sizes in ConsoleAnnotationOutputStream to avoid high churn of buffers when resetting at each end of a line.
|
Please take a moment and address the merge conflicts of your pull request. Thanks! |
…face' into stream-html-log # Conflicts: # bom/pom.xml # test/pom.xml
- Fix typo in documentation - use modern JavaScript (let/const/object spread) - use simpler type for header map - use descriptive variable in test helper Co-authored-by: Tim Jacomb <[email protected]>
|
Thanks for the feedback, Tim. I've addressed it in 831b743. |
|
Please take a moment and address the merge conflicts of your pull request. Thanks! |
|
The stapler upgrade with jenkinsci/stapler#722 is in #11221. Once that's merged, I can then remove the incremenal for stapler and mark this PR as ready for review. |
|
Please take a moment and address the merge conflicts of your pull request. Thanks! |
# Conflicts: # bom/pom.xml
jglick
left a comment
There was a problem hiding this comment.
Looks OK though I did not test it.
timja
left a comment
There was a problem hiding this comment.
Looks reasonable, untested.
/label ready-for-merge
This PR is now ready for merge, after ~24 hours, we will merge it if there's no negative feedback.
Thanks!
|
Checked with a simple Pipeline build that printed output at intervals, using built-in console viewer, on Firefox on Chrome. Works, though I am a bit confused since it is still opening a fresh HTTP request every second or so to |
|
The "streaming" applies to the server side request/response cycle. Previously, Before: start of request; read all the requested log bytes into memory; emit response with start/end/annotation state in headers |
|
Ah OK, so the multipart content type here is not used to send multiple chunks of text, merely to work around the fact that HTTP does not permit response headers to be written after content. |
Yes. Side note: There are Trailers in HTTP, but support for them remains very limited -- notably browsers do not expose them. |
|
Plugin compat tests failing, could you take a look please? |
@das7pad PTAL |
|
(We could really use a PR label on core & plugin PRs forcing a |
@jglick From which test is this? From the trace, it would be parsing the jenkins/core/src/main/resources/lib/hudson/progressive-text.js Lines 110 to 112 in 4702ffe Under which condition can |
Both of the ones observed to fail, links in #11177 (comment) You can reproduce failures yourself locally: cd pipeline-input-step-plugin
mvnd test -Dtest=InputStepTest -Djenkins.version=2.534I see With 2.533 it passes. A limitation in the JavaScript engine in HtmlUnit would not be all that surprising (jenkinsci/jenkins-test-harness#569), but then in the short term we need a way for the JS to detect the impoverished test environment and automatically fall back to the older implementation. |
I am no JS expert but it strikes me as more likely that when is run,fetchedBytes has not been defined at all, and null is being coerced to "null".
|
jenkins/core/src/main/resources/lib/hudson/progressive-text.js Lines 110 to 112 in 4702ffe |
|
I've added basic support for multipart/form-data responses in htmlunit (HtmlUnit/htmlunit#1054). After updating Jenkins, bom and I've opened jenkinsci/jenkins-test-harness-htmlunit#198 for pulling in the htmlunit patch right away, but I cannot get the build green. Any help will be much appreciated! For local testing: patch for upgradesdiff --git a/pom.xml b/pom.xml
index 42771ff..379c2ad 100644
--- a/pom.xml
+++ b/pom.xml
@@ -39,8 +39,8 @@
<properties>
<changelist>999999-SNAPSHOT</changelist>
<!-- https://www.jenkins.io/doc/developer/plugin-development/choosing-jenkins-baseline/ -->
- <jenkins.baseline>2.479</jenkins.baseline>
- <jenkins.version>${jenkins.baseline}.1</jenkins.version>
+ <jenkins.baseline>2.528</jenkins.baseline>
+ <jenkins.version>2.534</jenkins.version>
<gitHubRepo>jenkinsci/${project.artifactId}-plugin</gitHubRepo>
<hpi.strictBundledArtifacts>true</hpi.strictBundledArtifacts>
</properties>
@@ -49,7 +49,7 @@
<dependency>
<groupId>io.jenkins.tools.bom</groupId>
<artifactId>bom-${jenkins.baseline}.x</artifactId>
- <version>3893.v213a_42768d35</version>
+ <version>5601.v59f37270a_349</version>
<type>pom</type>
<scope>import</scope>
</dependency>
@@ -122,6 +122,12 @@
<artifactId>credentials-binding</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.jenkins-ci.main</groupId>
+ <artifactId>jenkins-test-harness</artifactId>
+ <version>2516.vc8fe6b_362b_19</version>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId> |

This PR is adopting the streaming/unbuffered reads from staplers
LargeTextinAnnotatedLargeTextand integrates it with the progressive-text in the frontend.Before: start of request; read all the requested log bytes into memory; emit response with start/end/annotation state in headers
After: start of request; stream the requested log bytes into multi-part response; emit another multi-part part with start/end/annotation state
Testing done
See updated tests for the
log/progressiveHtmlendpoint. Open console while build is in progress.Proposed changelog entries
Proposed changelog category
/label rfe
Proposed upgrade guidelines
N/A
Submitter checklist
@Restrictedor have@since TODOJavadocs, as appropriate.@Deprecated(since = "TODO")or@Deprecated(forRemoval = true, since = "TODO"), if applicable.evalto ease future introduction of Content Security Policy (CSP) directives (see documentation).Desired reviewers
cc @timja @jglick
Before the changes are marked as
ready-for-merge:Maintainer checklist
upgrade-guide-neededlabel is set and there is a Proposed upgrade guidelines section in the pull request title (see example).lts-candidateto be considered (see query).