Page MenuHomePhabricator

Jenkins collapsible console section plugin no more shows table of content
Closed, ResolvedPublic

Description

Upstream issue JENKINS-70906, pull, https://www.jenkins.io/blog/2023/05/12/removing-prototype-from-jenkins/

When browsing a job that has collapsible sections recognized in Jenkins ( ex: https://integration.wikimedia.org/ci/job/mediawiki-quibble-selenium-vendor-mysql-php74/lastSuccessfulBuild/console ), the table of content no more shows up in the sidebar.

There is a JavaScript error in the console:

behavior.js:120:27
11:45:52.851 ReferenceError: Ajax is not defined
    loadOutline https://integration.wikimedia.org/ci/static/ffdb6c1a/descriptor/org.jvnet.hudson.plugins.collapsingconsolesections.CollapsingSectionNote/script.js:79
    handle https://integration.wikimedia.org/ci/static/ffdb6c1a/descriptor/org.jvnet.hudson.plugins.collapsingconsolesections.CollapsingSectionNote/script.js:131
    section https://integration.wikimedia.org/ci/static/ffdb6c1a/descriptor/org.jvnet.hudson.plugins.collapsingconsolesections.CollapsingSectionNote/script.js:154
    applySubtree https://integration.wikimedia.org/ci/static/ffdb6c1a/scripts/behavior.js:117
    applySubtree https://integration.wikimedia.org/ci/static/ffdb6c1a/scripts/behavior.js:111
    applySubtree https://integration.wikimedia.org/ci/static/ffdb6c1a/scripts/behavior.js:109
    applySubtree https://integration.wikimedia.org/ci/static/ffdb6c1a/scripts/behavior.js:107
    apply https://integration.wikimedia.org/ci/static/ffdb6c1a/scripts/behavior.js:90
    start https://integration.wikimedia.org/ci/static/ffdb6c1a/scripts/behavior.js:85
    onload https://integration.wikimedia.org/ci/static/ffdb6c1a/scripts/behavior.js:152
    onload https://integration.wikimedia.org/ci/static/ffdb6c1a/scripts/behavior.js:152
    onload https://integration.wikimedia.org/ci/static/ffdb6c1a/scripts/behavior.js:152
    addLoadEvent https://integration.wikimedia.org/ci/static/ffdb6c1a/scripts/behavior.js:151
    <anonymous> https://integration.wikimedia.org/ci/static/ffdb6c1a/extensionList/hudson.console.ConsoleAnnotatorFactory/hudson.plugins.timestamper.annotator.TimestampAnnotatorFactory3/script.js:198
    <anonymous> https://integration.wikimedia.org/ci/static/ffdb6c1a/extensionList/hudson.console.ConsoleAnnotatorFactory/hudson.plugins.timestamper.annotator.TimestampAnnotatorFactory3/script.js:201
behavior.js:120:27
    applySubtree https://integration.wikimedia.org/ci/static/ffdb6c1a/scripts/behavior.js:120
    applySubtree https://integration.wikimedia.org/ci/static/ffdb6c1a/scripts/behavior.js:111
    applySubtree https://integration.wikimedia.org/ci/static/ffdb6c1a/scripts/behavior.js:109
    applySubtree https://integration.wikimedia.org/ci/static/ffdb6c1a/scripts/behavior.js:107
    apply https://integration.wikimedia.org/ci/static/ffdb6c1a/scripts/behavior.js:90
    start https://integration.wikimedia.org/ci/static/ffdb6c1a/scripts/behavior.js:85
    onload https://integration.wikimedia.org/ci/static/ffdb6c1a/scripts/behavior.js:152
    onload https://integration.wikimedia.org/ci/static/ffdb6c1a/scripts/behavior.js:152
    onload https://integration.wikimedia.org/ci/static/ffdb6c1a/scripts/behavior.js:152
    (Async: EventHandlerNonNull)
    addLoadEvent https://integration.wikimedia.org/ci/static/ffdb6c1a/scripts/behavior.js:151
    <anonymous> https://integration.wikimedia.org/ci/static/ffdb6c1a/extensionList/hudson.console.ConsoleAnnotatorFactory/hudson.plugins.timestamper.annotator.TimestampAnnotatorFactory3/script.js:198
    <anonymous> https://integration.wikimedia.org/ci/static/ffdb6c1a/extensionList/hudson.console.ConsoleAnnotatorFactory/hudson.plugins.timestamper.annotator.TimestampAnnotatorFactory3/script.js:201

The issue is somewhere between Jenkins 2.426.2 and 2.440.2.

The plugin source code is at https://github.com/jenkinsci/collapsing-console-sections-plugin and surely it has:

src/main/resources/org/jvnet/hudson/plugins/collapsingconsolesections/CollapsingSectionNote/script.js
function loadOutline() {
    if (outline !== null)  return false;   // already loaded

    if (!loading) {
        loading = true;

                    vvvv
        var u = new Ajax.Updater(document.getElementById("side-panel"),
                    ^^^^

            rootURL+"/descriptor/org.jvnet.hudson.plugins.collapsingconsolesections.CollapsingSectionNote/outline",
            {insertion: Insertion.Bottom, onComplete: function() {

Event Timeline

That might be https://github.com/jenkinsci/jenkins/pull/7781 which remove prototype from core , aka drop Prototype.JS. https://issues.jenkins.io/browse/JENKINS-70906

An example of Ajax.Updater being removed from Jenkins core is https://github.com/jenkinsci/jenkins/commit/d33dd2692022c255aadebc97b9097995ac42d170 which replaces the call with the modern fetch() API.

hashar renamed this task from Jenkins collapsible section plugin no more shows table of content to Jenkins collapsible console section plugin no more shows table of content.Apr 10 2024, 5:02 AM

Mentioned in SAL (#wikimedia-releng) [2024-04-10T05:14:02Z] <hashar> Restarted CI Jenkins to upgrade "collapsible console sections" plugin to a snapshot version having https://github.com/jenkinsci/collapsing-console-sections-plugin/pull/26 # T362048

hashar changed the task status from Open to Stalled.Apr 10 2024, 5:16 AM
hashar claimed this task.

That is solved. I am waiting for a review of https://github.com/jenkinsci/collapsing-console-sections-plugin/pull/27 and can then cut a new release and get it deployed to our instance. Marking this stalled until it happens.

Mentioned in SAL (#wikimedia-releng) [2024-04-16T11:32:32Z] <hashar> Released Collapsible Console Section Jenkins plugin 1.9.0 # T362048

I have released 1.9.0 of the plugin and apparently updated the CI Jenkins at that point since the file has:

Apr 16 13:38 collapsing-console-sections.jpi

I have checked the CI Jenkins and it runs 1.9.0 of the plugin. The JavaScript error is gone and the table of content does show up in the sidebar. My guess is I simply forgot to mark the task resolved.