Skip to content
Permalink
Browse files

Merge pull request #1995 from tfennelly/2.0-with-plugin-wizard

[FIX JENKINS-9598] 2.0 with plugin wizard
  • Loading branch information
daniel-beck committed Jan 26, 2016
2 parents e0919f1 + eb31451 commit 0d4d93d4502b63494ca8565b7bcad21abbf79519
Showing with 6,021 additions and 334 deletions.
  1. +94 −17 core/src/main/java/hudson/ClassicPluginStrategy.java
  2. +4 −27 core/src/main/java/hudson/LocalPluginManager.java
  3. +382 −45 core/src/main/java/hudson/PluginManager.java
  4. +10 −24 core/src/main/java/hudson/PluginWrapper.java
  5. +0 −10 core/src/main/java/hudson/init/InitStrategy.java
  6. +274 −5 core/src/main/java/hudson/model/UpdateCenter.java
  7. +21 −1 core/src/main/java/hudson/model/UpdateSite.java
  8. +130 −0 core/src/main/java/hudson/util/HttpResponses.java
  9. +113 −0 core/src/main/java/jenkins/I18n.java
  10. +0 −44 core/src/main/java/jenkins/diagnostics/PinningIsBlockingBundledPluginMonitor.java
  11. +65 −0 core/src/main/java/jenkins/install/InstallState.java
  12. +230 −0 core/src/main/java/jenkins/install/InstallUtil.java
  13. +112 −0 core/src/main/java/jenkins/model/AssetManager.java
  14. +91 −19 core/src/main/java/jenkins/model/Jenkins.java
  15. +91 −0 core/src/main/java/jenkins/util/ResourceBundleUtil.java
  16. +140 −2 core/src/main/java/jenkins/util/xml/XMLUtils.java
  17. +0 −13 core/src/main/resources/jenkins/diagnostics/PinningIsBlockingBundledPluginMonitor/message.jelly
  18. +0 −4 core/src/main/resources/jenkins/diagnostics/PinningIsBlockingBundledPluginMonitor/message.properties
  19. +0 −32 ...rc/main/resources/jenkins/diagnostics/PinningIsBlockingBundledPluginMonitor/message_ja.properties
  20. +0 −30 ...main/resources/jenkins/diagnostics/PinningIsBlockingBundledPluginMonitor/message_pt_BR.properties
  21. +38 −0 core/src/main/resources/jenkins/install/pluginSetupWizard.properties
  22. +1 −0 core/src/main/resources/jenkins/install/pluginSetupWizard_de.properties
  23. +1 −0 core/src/main/resources/jenkins/install/pluginSetupWizard_es.properties
  24. +8 −1 core/src/main/resources/lib/layout/layout.jelly
  25. +69 −0 core/src/test/java/hudson/ClassicPluginStrategyTest.java
  26. +56 −0 core/src/test/java/hudson/util/JSONObjectResponseTest.java
  27. +69 −0 core/src/test/java/jenkins/util/ResourceBundleUtilTest.java
  28. +33 −0 core/src/test/java/jenkins/xml/XMLUtilsTest.java
  29. +8 −0 core/src/test/resources/jenkins/xml/config.xml
  30. +1 −1 plugins/pom.xml
  31. +1 −1 test/pom.xml
  32. +26 −0 test/src/test/java/hudson/ClassicPluginStrategyTest.java
  33. +22 −3 test/src/test/java/hudson/PluginManagerInstalledGUITest.java
  34. +21 −0 test/src/test/java/hudson/PluginManagerTest.java
  35. +0 −16 test/src/test/java/hudson/PluginManagerTest2.java
  36. +161 −0 test/src/test/java/hudson/model/UpdateCenterConnectionStatusTest.java
  37. +93 −0 test/src/test/java/hudson/model/UpdateCenterPluginInstallTest.java
  38. +64 −0 test/src/test/java/jenkins/I18nTest.java
  39. +201 −0 test/src/test/java/jenkins/install/InstallUtilTest.java
  40. +9 −1 war/.gitignore
  41. +0 −10 war/Gruntfile.js
  42. +15 −0 war/gulpfile.js
  43. +19 −10 war/package.json
  44. +231 −18 war/pom.xml
  45. +188 −0 war/src/main/js/api/pluginManager.js
  46. +86 −0 war/src/main/js/api/plugins.js
  47. +10 −0 war/src/main/js/pluginSetupWizard.js
  48. +790 −0 war/src/main/js/pluginSetupWizardGui.js
  49. +11 −0 war/src/main/js/templates/errorPanel.hbs
  50. +24 −0 war/src/main/js/templates/incompleteInstallationPanel.hbs
  51. +1 −0 war/src/main/js/templates/loadingPanel.hbs
  52. +10 −0 war/src/main/js/templates/offlinePanel.hbs
  53. +57 −0 war/src/main/js/templates/pluginSelectionPanel.hbs
  54. +7 −0 war/src/main/js/templates/pluginSetupWizard.hbs
  55. +21 −0 war/src/main/js/templates/progressPanel.hbs
  56. +27 −0 war/src/main/js/templates/successPanel.hbs
  57. +31 −0 war/src/main/js/templates/welcomePanel.hbs
  58. +188 −0 war/src/main/js/util/jenkins.js
  59. +748 −0 war/src/main/less/pluginSetupWizard.less
  60. +5 −0 war/src/main/webapp/WEB-INF/web.xml
  61. +418 −0 war/src/main/webapp/css/icons/icomoon.css
  62. BIN war/src/main/webapp/css/icons/icomoon/icomoon.eot
  63. +141 −0 war/src/main/webapp/css/icons/icomoon/icomoon.svg
  64. BIN war/src/main/webapp/css/icons/icomoon/icomoon.ttf
  65. BIN war/src/main/webapp/css/icons/icomoon/icomoon.woff
  66. +354 −0 war/src/test/js/pluginSetupWizard-spec.js
@@ -65,6 +65,7 @@
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import java.util.Vector;
@@ -74,6 +75,10 @@
import java.util.logging.Level;
import java.util.logging.Logger;
import org.jenkinsci.bytecode.Transformer;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;

import javax.annotation.Nonnull;

import static org.apache.commons.io.FilenameUtils.getBaseName;

@@ -279,10 +284,66 @@ protected ClassLoader createClassLoader(List<File> paths, ClassLoader parent, At
return classLoader;
}

/**
* Get the list of all plugins that have ever been {@link DetachedPlugin detached} from Jenkins core.
* @return A {@link List} of {@link DetachedPlugin}s.
*/
@Restricted(NoExternalUse.class)
public static @Nonnull List<DetachedPlugin> getDetachedPlugins() {
return DETACHED_LIST;
}

/**
* Get the list of plugins that have been detached since a specific Jenkins release version.
* @param since The Jenkins version.
* @return A {@link List} of {@link DetachedPlugin}s.
*/
@Restricted(NoExternalUse.class)
public static @Nonnull List<DetachedPlugin> getDetachedPlugins(@Nonnull VersionNumber since) {
List<DetachedPlugin> detachedPlugins = new ArrayList<>();

for (DetachedPlugin detachedPlugin : DETACHED_LIST) {
if (!detachedPlugin.getSplitWhen().isOlderThan(since)) {
detachedPlugins.add(detachedPlugin);
}
}

return detachedPlugins;
}

/**
* Is the named plugin a plugin that was detached from Jenkins at some point in the past.
* @param pluginId The plugin ID.
* @return {@code true} if the plugin is a plugin that was detached from Jenkins at some
* point in the past, otherwise {@code false}.
*/
@Restricted(NoExternalUse.class)
public static boolean isDetachedPlugin(@Nonnull String pluginId) {
for (DetachedPlugin detachedPlugin : DETACHED_LIST) {
if (detachedPlugin.getShortName().equals(pluginId)) {
return true;
}
}

return false;
}

/**
* Information about plugins that were originally in the core.
* <p>
* A detached plugin is one that has any of the following characteristics:
* <ul>
* <li>
* Was an existing plugin that at some time previously bundled with the Jenkins war file.
* </li>
* <li>
* Was previous code in jenkins core that was split to a separate-plugin (but may not have
* ever been bundled in a jenkins war file - i.e. it gets split after this 2.0 update).
* </li>
* </ul>
*/
private static final class DetachedPlugin {
@Restricted(NoExternalUse.class)
public static final class DetachedPlugin {
private final String shortName;
/**
* Plugins built for this Jenkins version (and earlier) will automatically be assumed to have
@@ -300,6 +361,22 @@ private DetachedPlugin(String shortName, String splitWhen, String requireVersion
this.requireVersion = requireVersion;
}

/**
* Get the short name of the plugin.
* @return The short name of the plugin.
*/
public String getShortName() {
return shortName;
}

/**
* Get the Jenkins version from which the plugin was detached.
* @return The Jenkins version from which the plugin was detached.
*/
public VersionNumber getSplitWhen() {
return splitWhen;
}

private void fix(Attributes atts, List<PluginWrapper.Dependency> optionalDependencies) {
// don't fix the dependency for yourself, or else we'll have a cycle
String yourName = atts.getValue("Short-Name");
@@ -320,22 +397,22 @@ private void fix(Attributes atts, List<PluginWrapper.Dependency> optionalDepende
}
}

private static final List<DetachedPlugin> DETACHED_LIST = Arrays.asList(
new DetachedPlugin("maven-plugin","1.296","1.296"),
new DetachedPlugin("subversion","1.310","1.0"),
new DetachedPlugin("cvs","1.340","0.1"),
new DetachedPlugin("ant","1.430.*","1.0"),
new DetachedPlugin("javadoc","1.430.*","1.0"),
new DetachedPlugin("external-monitor-job","1.467.*","1.0"),
new DetachedPlugin("ldap","1.467.*","1.0"),
new DetachedPlugin("pam-auth","1.467.*","1.0"),
new DetachedPlugin("mailer","1.493.*","1.2"),
new DetachedPlugin("matrix-auth","1.535.*","1.0.2"),
new DetachedPlugin("windows-slaves","1.547.*","1.0"),
new DetachedPlugin("antisamy-markup-formatter","1.553.*","1.0"),
new DetachedPlugin("matrix-project","1.561.*","1.0"),
new DetachedPlugin("junit","1.577.*","1.0")
);
private static final List<DetachedPlugin> DETACHED_LIST = Collections.unmodifiableList(Arrays.asList(
new DetachedPlugin("maven-plugin", "1.296", "1.296"),
new DetachedPlugin("subversion", "1.310", "1.0"),
new DetachedPlugin("cvs", "1.340", "0.1"),
new DetachedPlugin("ant", "1.430.*", "1.0"),
new DetachedPlugin("javadoc", "1.430.*", "1.0"),
new DetachedPlugin("external-monitor-job", "1.467.*", "1.0"),
new DetachedPlugin("ldap", "1.467.*", "1.0"),
new DetachedPlugin("pam-auth", "1.467.*", "1.0"),
new DetachedPlugin("mailer", "1.493.*", "1.2"),
new DetachedPlugin("matrix-auth", "1.535.*", "1.0.2"),
new DetachedPlugin("windows-slaves", "1.547.*", "1.0"),
new DetachedPlugin("antisamy-markup-formatter", "1.553.*", "1.0"),
new DetachedPlugin("matrix-project", "1.561.*", "1.0"),
new DetachedPlugin("junit", "1.577.*", "1.0")
));

/** Implicit dependencies that are known to be unnecessary and which must be cut out to prevent a dependency cycle among bundled plugins. */
private static final Set<String> BREAK_CYCLES = new HashSet<String>(Arrays.asList(
@@ -26,15 +26,9 @@

import jenkins.model.Jenkins;

import javax.servlet.ServletContext;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
@@ -64,28 +58,11 @@ public LocalPluginManager(File rootDir) {
return Collections.emptySet();
}

Set<String> names = new HashSet<String>();

ServletContext context = Jenkins.getInstance().servletContext;

for( String path : Util.fixNull((Set<String>)context.getResourcePaths("/WEB-INF/plugins"))) {
String fileName = path.substring(path.lastIndexOf('/')+1);
if(fileName.length()==0) {
// see http://www.nabble.com/404-Not-Found-error-when-clicking-on-help-td24508544.html
// I suspect some containers are returning directory names.
continue;
}
try {
names.add(fileName);

URL url = context.getResource(path);
copyBundledPlugin(url, fileName);
} catch (IOException e) {
LOGGER.log(Level.SEVERE, "Failed to extract the bundled plugin "+fileName,e);
}
try {
return loadPluginsFromWar("/WEB-INF/plugins");
} finally {
loadDetachedPlugins();
}

return names;
}

private static final Logger LOGGER = Logger.getLogger(LocalPluginManager.class.getName());

0 comments on commit 0d4d93d

Please sign in to comment.
You can’t perform that action at this time.