Skip to content

Conversation

@das7pad
Copy link
Contributor

@das7pad das7pad commented Oct 4, 2025

Instead of reading the entire step log into memory before emitting parts of it, this PR is implementing streaming based reading for step logs.

Now that the log-index is read incrementally while streaming, the length
of the step log needs to be determined before returning. The only option
for determining the step logs length is by reading the full index file.
A new IndexReader class abstracts the parsing of the index. It is used
by both the full read in advance and the incremental read while
streaming the log content.

Testing done

Previous PRs have added good coverage for the happy paths and edge cases when reading the index.

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests that demonstrate the feature works or the issue is fixed

Now that the log-index is read incrementally while streaming, the length
of the step log needs to be determined before returning. The only option
for determining the step logs length is by reading the full index file.
A new IndexReader class abstracts the parsing of the index. It is used
by both the full read in advance and the incremental read while
streaming the log content.
@das7pad das7pad requested a review from a team as a code owner October 4, 2025 12:49
@jglick jglick marked this pull request as draft October 6, 2025 13:26
@jglick jglick requested a review from dwnusbaum October 6, 2025 13:27
Copy link
Member

@jglick jglick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks OK. Did not follow all of it.

Comment on lines +326 to +328
while (readNext(next)) {
stepLogSize += (next.end - next.start);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does not seem particularly efficient, but I guess it can be optimized later as needed.

Comment on lines -313 to -315
// LargeText also needs to be improved to support opaque (non-long) cursors
// (and callers such as progressiveText.jelly and Blue Ocean updated accordingly),
// which is a hard requirement for efficient rendering of cloud-backed logs,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still true I think. (Blue Ocean is moribund, but the same comment potentially applies to anything rendering JEP-210-based logs.) OTOH there has been no recent development in this area; CloudBees does maintain a cloud-backed log storage, but largely using private API contracts.

Copy link
Member

@dwnusbaum dwnusbaum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks ok! I did not try to test it.

@das7pad
Copy link
Contributor Author

das7pad commented Oct 18, 2025

jenkinsci/jenkins#11071 has been merged and included in Jenkins core 2.532 -> 9dea640.

@das7pad das7pad marked this pull request as ready for review October 18, 2025 22:37
Copy link
Member

@jglick jglick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK AFAICT

@jglick
Copy link
Member

jglick commented Oct 22, 2025

Would like to test it against CloudBees CI and pipeline-cloudwatch-logs though.

@jglick
Copy link
Member

jglick commented Oct 22, 2025

Actually pipeline-cloudwatch-logs is not affected by this since it does not use FileLogStorage. It perhaps could benefit from the new Source, but I do not have time to work on it. Anyway the entire long-based cursor design of LargeText is unusable for this alternate implementation, as previously noted, forcing it to basically download the entire log just to produce a stream.

@jglick jglick merged commit 6703075 into jenkinsci:master Oct 22, 2025
17 checks passed
@das7pad
Copy link
Contributor Author

das7pad commented Oct 22, 2025

Thanks for the reviews and merging it!

Would you mind creating a new release to make it available in pipeline-graph-view-plugin?

@timja
Copy link
Member

timja commented Oct 22, 2025

Release failed due to expired tokens:
https://github.com/jenkinsci/workflow-api-plugin/actions/runs/18721968362/job/53396507179

I've re-triggered it, tokens are 2 hours old so should be fine currently

@timja
Copy link
Member

timja commented Oct 22, 2025

https://github.com/jenkinsci/workflow-api-plugin/releases/tag/1398.v67030756d3fb_

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants