During fixing of JENKINS-34669 I've discovered that Jenkins 2.1 bundles the obsolete version of jenkins-js-builder. The last release version is 0.0.51, but Jenkins core still bundles 0.0.40. It means the core does not get patches like this one: https://github.com/tfennelly/jenkins-js-modules/commit/dd98ceefcc28861b11272214aeb9bc32a3aaae62

      This fix is required to prevent fatal failures on module duplicates

      Background

      We have a plugin, which tweaks Jenkins UI before the startup in order to initialize some stuff (add extra plugins, etc.). So the plugin has an additional UI page. When I bundle this plugin into Jenkins.war, Jenkins 2.0 installation Wizard hangs infinitely.
      
      According to the JS debugger, it happens due to the ""Jenkins global module 'pluginSetupWizard' already registered." error. There are stacktraces for the first and second export operations.
      
      Jenkins WebUI should at least return an error for such failures. Ideally it should be robust agains such "hacks in plugins"
      

        1. firstCall.png
          firstCall.png
          305 kB
        2. hangingInstallationWizard.png
          hangingInstallationWizard.png
          137 kB
        3. secondCall.png
          secondCall.png
          278 kB

          [JENKINS-34676] Duplicate include of pluginSetupWizard.js

          Oleg Nenashev added a comment -

          According to the clarification from recena, these issues are not duplicates. This one is rather about an unflexible behavior of js-modules. But yes, fix of JENKINS-34669 should also solve it for the default core. IIRC tfennelly is working on it

          Oleg Nenashev added a comment - According to the clarification from recena , these issues are not duplicates. This one is rather about an unflexible behavior of js-modules. But yes, fix of JENKINS-34669 should also solve it for the default core. IIRC tfennelly is working on it

          Tom FENNELLY added a comment -

          Hmmm how are these not duplicates? IOW ... what's the remaining issue once I fix JENKINS-34669 ?

          Tom FENNELLY added a comment - Hmmm how are these not duplicates? IOW ... what's the remaining issue once I fix JENKINS-34669 ?

          Oleg Nenashev added a comment -

          I think we need to upgrade js-modules. It should also prevent hanging on similar cases

          Oleg Nenashev added a comment - I think we need to upgrade js-modules. It should also prevent hanging on similar cases

          Oleg Nenashev added a comment -

          I'll rephrase the issue

          Oleg Nenashev added a comment - I'll rephrase the issue

          Oleg Nenashev added a comment -

          danielbeck tfennelly
          Is it better now?

          Oleg Nenashev added a comment - danielbeck tfennelly Is it better now?

          Tom FENNELLY added a comment -

          But the root cause issue is that there are duplicate .js files on the page. The js-modules that's in use there will work fine so long as there are not multiple .js files trying to export to the same namespace.

          Tom FENNELLY added a comment - But the root cause issue is that there are duplicate .js files on the page. The js-modules that's in use there will work fine so long as there are not multiple .js files trying to export to the same namespace.

          Tom FENNELLY added a comment -

          kzantow has agreed to resolve the underlying issue as part of https://github.com/jenkinsci/jenkins/pull/2281

          b5576a7 might be the commit, but need to check with Keith.

          Tom FENNELLY added a comment - kzantow has agreed to resolve the underlying issue as part of https://github.com/jenkinsci/jenkins/pull/2281 b5576a7 might be the commit, but need to check with Keith.

          Code changed in jenkins
          User: kzantow
          Path:
          core/src/main/java/hudson/PluginManager.java
          core/src/main/java/jenkins/install/InstallState.java
          core/src/main/java/jenkins/install/InstallStateFilter.java
          core/src/main/java/jenkins/install/InstallUtil.java
          core/src/main/java/jenkins/install/SetupWizard.java
          core/src/main/java/jenkins/install/UpgradeWizard.java
          core/src/main/java/jenkins/model/Jenkins.java
          core/src/main/resources/hudson/security/GlobalSecurityConfiguration/index.groovy
          core/src/main/resources/jenkins/install/SetupWizard/authenticate-security-token.jelly
          core/src/main/resources/jenkins/install/SetupWizard/client-scripts.jelly
          core/src/main/resources/jenkins/install/SetupWizard/footer.jelly
          core/src/main/resources/jenkins/install/SetupWizard/index.jelly
          core/src/main/resources/jenkins/install/SetupWizard/wizard-ui.jelly
          core/src/main/resources/jenkins/install/UpgradeWizard/client-scripts.jelly
          core/src/main/resources/jenkins/install/UpgradeWizard/client-scripts.properties
          core/src/main/resources/jenkins/install/UpgradeWizard/client-scripts_fr.properties
          core/src/main/resources/jenkins/install/UpgradeWizard/client-scripts_lt.properties
          core/src/main/resources/jenkins/install/UpgradeWizard/footer.jelly
          core/src/main/resources/jenkins/install/UpgradeWizard/footer.properties
          core/src/main/resources/jenkins/install/UpgradeWizard/footer_fr.properties
          core/src/main/resources/jenkins/install/UpgradeWizard/footer_lt.properties
          core/src/main/resources/jenkins/install/pluginSetupWizard.properties
          core/src/main/resources/jenkins/model/Jenkins/login.jelly
          core/src/main/resources/jenkins/model/Jenkins/loginError.jelly
          core/src/main/resources/lib/layout/html.jelly
          test/src/test/java/jenkins/install/InstallUtilTest.java
          test/src/test/java/jenkins/install/SetupWizardTest.java
          test/src/test/java/jenkins/install/UpgradeWizardTest.java
          test/src/test/java/jenkins/util/SystemPropertiesTest.java
          war/gulpfile.js
          war/src/main/js/api/pluginManager.js
          war/src/main/js/pluginSetupWizardGui.js
          war/src/main/js/templates/pluginSelectList.hbs
          war/src/main/js/templates/pluginSelectionPanel.hbs
          war/src/main/js/templates/successPanel.hbs
          war/src/main/js/templates/upgradePanel.hbs
          war/src/main/js/templates/upgradeSkippedPanel.hbs
          war/src/main/js/templates/upgradeSuccessPanel.hbs
          war/src/main/js/upgradeWizard.js
          war/src/main/js/util/jenkins.js
          war/src/main/less/pluginSetupWizard.less
          war/src/main/webapp/WEB-INF/web.xml
          war/src/main/webapp/css/style.css
          war/src/test/js/pluginSetupWizard-spec.js
          http://jenkins-ci.org/commit/jenkins/89a24abcb0eabc36c7281979d1620c92b6a128a9
          Log:
          [FIX JENKINS-33663] - Upgrade wizard

          Add Upgrade Wizard
          Add 'replace' handlebars method in jenkins.js
          Fix state transitions to follow a single basic pattern
          Suggested plugins selected by default
          Add an install state for INITIAL_SECURITY_SETUP
          Removed duplicate setupWizard.js on page [FIX JENKINS-34676]
          Exclude plugins which are already installed when determining platform
          Change 'snooze' to not look like a 'close' button
          Make sure unlock screen doesn't show up after new install
          Add compatibility check when offering suggested plugins
          More appropriate handling of security token filter

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: kzantow Path: core/src/main/java/hudson/PluginManager.java core/src/main/java/jenkins/install/InstallState.java core/src/main/java/jenkins/install/InstallStateFilter.java core/src/main/java/jenkins/install/InstallUtil.java core/src/main/java/jenkins/install/SetupWizard.java core/src/main/java/jenkins/install/UpgradeWizard.java core/src/main/java/jenkins/model/Jenkins.java core/src/main/resources/hudson/security/GlobalSecurityConfiguration/index.groovy core/src/main/resources/jenkins/install/SetupWizard/authenticate-security-token.jelly core/src/main/resources/jenkins/install/SetupWizard/client-scripts.jelly core/src/main/resources/jenkins/install/SetupWizard/footer.jelly core/src/main/resources/jenkins/install/SetupWizard/index.jelly core/src/main/resources/jenkins/install/SetupWizard/wizard-ui.jelly core/src/main/resources/jenkins/install/UpgradeWizard/client-scripts.jelly core/src/main/resources/jenkins/install/UpgradeWizard/client-scripts.properties core/src/main/resources/jenkins/install/UpgradeWizard/client-scripts_fr.properties core/src/main/resources/jenkins/install/UpgradeWizard/client-scripts_lt.properties core/src/main/resources/jenkins/install/UpgradeWizard/footer.jelly core/src/main/resources/jenkins/install/UpgradeWizard/footer.properties core/src/main/resources/jenkins/install/UpgradeWizard/footer_fr.properties core/src/main/resources/jenkins/install/UpgradeWizard/footer_lt.properties core/src/main/resources/jenkins/install/pluginSetupWizard.properties core/src/main/resources/jenkins/model/Jenkins/login.jelly core/src/main/resources/jenkins/model/Jenkins/loginError.jelly core/src/main/resources/lib/layout/html.jelly test/src/test/java/jenkins/install/InstallUtilTest.java test/src/test/java/jenkins/install/SetupWizardTest.java test/src/test/java/jenkins/install/UpgradeWizardTest.java test/src/test/java/jenkins/util/SystemPropertiesTest.java war/gulpfile.js war/src/main/js/api/pluginManager.js war/src/main/js/pluginSetupWizardGui.js war/src/main/js/templates/pluginSelectList.hbs war/src/main/js/templates/pluginSelectionPanel.hbs war/src/main/js/templates/successPanel.hbs war/src/main/js/templates/upgradePanel.hbs war/src/main/js/templates/upgradeSkippedPanel.hbs war/src/main/js/templates/upgradeSuccessPanel.hbs war/src/main/js/upgradeWizard.js war/src/main/js/util/jenkins.js war/src/main/less/pluginSetupWizard.less war/src/main/webapp/WEB-INF/web.xml war/src/main/webapp/css/style.css war/src/test/js/pluginSetupWizard-spec.js http://jenkins-ci.org/commit/jenkins/89a24abcb0eabc36c7281979d1620c92b6a128a9 Log: [FIX JENKINS-33663] - Upgrade wizard Add Upgrade Wizard Add 'replace' handlebars method in jenkins.js Fix state transitions to follow a single basic pattern Suggested plugins selected by default Add an install state for INITIAL_SECURITY_SETUP Removed duplicate setupWizard.js on page [FIX JENKINS-34676] Exclude plugins which are already installed when determining platform Change 'snooze' to not look like a 'close' button Make sure unlock screen doesn't show up after new install Add compatibility check when offering suggested plugins More appropriate handling of security token filter

          kzantow Do you think this issue should be updated?

          Manuel Recena Soto added a comment - kzantow Do you think this issue should be updated?

          Keith Zantow added a comment -

          recena this should be split to 2 issues. I think we should change the title of this to 'duplicate js included' or something similar and close this ticket.

          Keith Zantow added a comment - recena this should be split to 2 issues. I think we should change the title of this to 'duplicate js included' or something similar and close this ticket.

            recena Manuel Recena Soto
            oleg_nenashev Oleg Nenashev
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: