|
@@ -316,7 +316,7 @@ |
|
|
public transient final Lookup lookup = new Lookup(); |
|
|
|
|
|
/** |
|
|
* We update this field to the current version of Hudson whenever we save {@code config.xml}. |
|
|
* We update this field to the current version of Jenkins whenever we save {@code config.xml}. |
|
|
* This can be used to detect when an upgrade happens from one version to next. |
|
|
* |
|
|
* <p> |
|
@@ -351,7 +351,7 @@ |
|
|
/** |
|
|
* Controls how the |
|
|
* <a href="http://en.wikipedia.org/wiki/Authorization">authorization</a> |
|
|
* is handled in Hudson. |
|
|
* is handled in Jenkins. |
|
|
* <p> |
|
|
* This ultimately controls who has access to what. |
|
|
* |
|
@@ -362,7 +362,7 @@ |
|
|
/** |
|
|
* Controls a part of the |
|
|
* <a href="http://en.wikipedia.org/wiki/Authentication">authentication</a> |
|
|
* handling in Hudson. |
|
|
* handling in Jenkins. |
|
|
* <p> |
|
|
* Intuitively, this corresponds to the user database. |
|
|
* |
|
@@ -466,7 +466,7 @@ public DescriptorExtensionList compute(Class key) { |
|
|
}; |
|
|
|
|
|
/** |
|
|
* {@link Computer}s in this Hudson system. Read-only. |
|
|
* {@link Computer}s in this Jenkins system. Read-only. |
|
|
*/ |
|
|
protected transient final Map<Node,Computer> computers = new CopyOnWriteMap.Hash<Node,Computer>(); |
|
|
|
|
@@ -644,7 +644,7 @@ protected void onModified() throws IOException { |
|
|
public transient final List<AdministrativeMonitor> administrativeMonitors = getExtensionList(AdministrativeMonitor.class); |
|
|
|
|
|
/** |
|
|
* Widgets on Hudson. |
|
|
* Widgets on Jenkins. |
|
|
*/ |
|
|
private transient final List<Widget> widgets = getExtensionList(Widget.class); |
|
|
|
|
@@ -881,7 +881,7 @@ protected void doRun() throws Exception { |
|
|
* Executes a reactor. |
|
|
* |
|
|
* @param is |
|
|
* If non-null, this can be consulted for ignoring some tasks. Only used during the initialization of Hudson. |
|
|
* If non-null, this can be consulted for ignoring some tasks. Only used during the initialization of Jenkins. |
|
|
*/ |
|
|
private void executeReactor(final InitStrategy is, TaskBuilder... builders) throws IOException, InterruptedException, ReactorException { |
|
|
Reactor reactor = new Reactor(builders) { |
|
@@ -1186,7 +1186,7 @@ public Descriptor getDescriptorOrDie(Class<? extends Describable> type) { |
|
|
} |
|
|
|
|
|
/** |
|
|
* Gets the {@link Descriptor} instance in the current Hudson by its type. |
|
|
* Gets the {@link Descriptor} instance in the current Jenkins by its type. |
|
|
*/ |
|
|
public <T extends Descriptor> T getDescriptorByType(Class<T> type) { |
|
|
for( Descriptor d : getExtensionList(Descriptor.class) ) |
|
@@ -1343,7 +1343,7 @@ public String getFullDisplayName() { |
|
|
* |
|
|
* <p> |
|
|
* To register an {@link Action}, implement {@link RootAction} extension point, or write code like |
|
|
* {@code Hudson.getInstance().getActions().add(...)}. |
|
|
* {@code Jenkins.getInstance().getActions().add(...)}. |
|
|
* |
|
|
* @return |
|
|
* Live list where the changes can be made. Can be empty but never null. |
|
@@ -1481,7 +1481,7 @@ public void onViewRenamed(View view, String oldName, String newName) { |
|
|
} |
|
|
|
|
|
/** |
|
|
* Returns the primary {@link View} that renders the top-page of Hudson. |
|
|
* Returns the primary {@link View} that renders the top-page of Jenkins. |
|
|
*/ |
|
|
@Exported |
|
|
public View getPrimaryView() { |
|
@@ -1517,7 +1517,7 @@ public void setMyViewsTabBar(MyViewsTabBar myViewsTabBar) { |
|
|
* |
|
|
* <p> |
|
|
* This method continues to return true until the system configuration is saved, at which point |
|
|
* {@link #version} will be overwritten and Hudson forgets the upgrade history. |
|
|
* {@link #version} will be overwritten and Jenkins forgets the upgrade history. |
|
|
* |
|
|
* <p> |
|
|
* To handle SNAPSHOTS correctly, pass in "1.N.*" to test if it's upgrading from the version |
|
@@ -1661,7 +1661,7 @@ public JDK getJDK(String name) { |
|
|
|
|
|
|
|
|
/** |
|
|
* Gets the slave node of the give name, hooked under this Hudson. |
|
|
* Gets the slave node of the give name, hooked under this Jenkins. |
|
|
*/ |
|
|
public @CheckForNull Node getNode(String name) { |
|
|
return nodes.getNode(name); |
|
@@ -1687,14 +1687,14 @@ public Cloud getCloud(String name) { |
|
|
} |
|
|
|
|
|
/** |
|
|
* Adds one more {@link Node} to Hudson. |
|
|
* Adds one more {@link Node} to Jenkins. |
|
|
*/ |
|
|
public void addNode(Node n) throws IOException { |
|
|
nodes.addNode(n); |
|
|
} |
|
|
|
|
|
/** |
|
|
* Removes a {@link Node} from Hudson. |
|
|
* Removes a {@link Node} from Jenkins. |
|
|
*/ |
|
|
public void removeNode(@Nonnull Node n) throws IOException { |
|
|
nodes.removeNode(n); |
|
@@ -1904,7 +1904,7 @@ public boolean isRootUrlSecure() { |
|
|
} |
|
|
|
|
|
/** |
|
|
* Gets the absolute URL of Hudson top page, such as {@code http://localhost/hudson/}. |
|
|
* Gets the absolute URL of Jenkins top page, such as {@code http://localhost/jenkins/}. |
|
|
* |
|
|
* <p> |
|
|
* Unlike {@link #getRootUrl()}, which uses the manually configured value, |
|
@@ -2070,17 +2070,16 @@ public boolean isUseProjectNamingStrategy(){ |
|
|
} |
|
|
|
|
|
/** |
|
|
* If true, all the POST requests to Hudson would have to have crumb in it to protect |
|
|
* Hudson from CSRF vulnerabilities. |
|
|
* If true, all the POST requests to Jenkins would have to have crumb in it to protect |
|
|
* Jenkins from CSRF vulnerabilities. |
|
|
*/ |
|
|
@Exported |
|
|
public boolean isUseCrumbs() { |
|
|
return crumbIssuer!=null; |
|
|
} |
|
|
|
|
|
/** |
|
|
* Returns the constant that captures the three basic security modes |
|
|
* in Hudson. |
|
|
* Returns the constant that captures the three basic security modes in Jenkins. |
|
|
*/ |
|
|
public SecurityMode getSecurity() { |
|
|
// fix the variable so that this code works under concurrent modification to securityRealm. |
|
@@ -2277,7 +2276,7 @@ public ProjectNamingStrategy getProjectNamingStrategy() { |
|
|
} |
|
|
|
|
|
/** |
|
|
* Returns true if Hudson is quieting down. |
|
|
* Returns true if Jenkins is quieting down. |
|
|
* <p> |
|
|
* No further jobs will be executed unless it |
|
|
* can be finished while other current pending builds |
|
@@ -2507,7 +2506,7 @@ public synchronized void putItem(TopLevelItem item) throws IOException, Interrup |
|
|
|
|
|
/** |
|
|
* Called by {@link Job#renameTo(String)} to update relevant data structure. |
|
|
* assumed to be synchronized on Hudson by the caller. |
|
|
* assumed to be synchronized on Jenkins by the caller. |
|
|
*/ |
|
|
public void onRenamed(TopLevelItem job, String oldName, String newName) throws IOException { |
|
|
items.remove(oldName); |
|
@@ -2616,7 +2615,7 @@ private synchronized TaskBuilder loadTasks() throws IOException { |
|
|
final Set<String> loadedNames = Collections.synchronizedSet(new HashSet<String>()); |
|
|
|
|
|
TaskGraphBuilder g = new TaskGraphBuilder(); |
|
|
Handle loadHudson = g.requires(EXTENSIONS_AUGMENTED).attains(JOB_LOADED).add("Loading global config", new Executable() { |
|
|
Handle loadJenkins = g.requires(EXTENSIONS_AUGMENTED).attains(JOB_LOADED).add("Loading global config", new Executable() { |
|
|
public void run(Reactor session) throws Exception { |
|
|
XmlFile cfg = getConfigFile(); |
|
|
if (cfg.exists()) { |
|
@@ -2642,7 +2641,7 @@ public void run(Reactor session) throws Exception { |
|
|
}); |
|
|
|
|
|
for (final File subdir : subdirs) { |
|
|
g.requires(loadHudson).attains(JOB_LOADED).notFatal().add("Loading job "+subdir.getName(),new Executable() { |
|
|
g.requires(loadJenkins).attains(JOB_LOADED).notFatal().add("Loading job "+subdir.getName(),new Executable() { |
|
|
public void run(Reactor session) throws Exception { |
|
|
if(!Items.getConfigFile(subdir).exists()) { |
|
|
//Does not have job config file, so it is not a jenkins job hence skip it |
|
@@ -2682,7 +2681,7 @@ public void run(Reactor session) throws Exception { |
|
|
} |
|
|
|
|
|
// initialize views by inserting the default view if necessary |
|
|
// this is both for clean Hudson and for backward compatibility. |
|
|
// this is both for clean Jenkins and for backward compatibility. |
|
|
if(views.size()==0 || primaryView==null) { |
|
|
View v = new AllView(Messages.Hudson_ViewName()); |
|
|
setViewOwner(v); |
|
@@ -3298,7 +3297,7 @@ public DirectoryBrowserSupport doUserContent() { |
|
|
} |
|
|
|
|
|
/** |
|
|
* Perform a restart of Hudson, if we can. |
|
|
* Perform a restart of Jenkins, if we can. |
|
|
* |
|
|
* This first replaces "app" to {@link HudsonIsRestarting} |
|
|
*/ |
|
@@ -3317,7 +3316,7 @@ public void doRestart(StaplerRequest req, StaplerResponse rsp) throws IOExceptio |
|
|
} |
|
|
|
|
|
/** |
|
|
* Queues up a restart of Hudson for when there are no builds running, if we can. |
|
|
* Queues up a restart of Jenkins for when there are no builds running, if we can. |
|
|
* |
|
|
* This first replaces "app" to {@link HudsonIsRestarting} |
|
|
* |
|
@@ -3339,7 +3338,7 @@ public HttpResponse doSafeRestart(StaplerRequest req) throws IOException, Servle |
|
|
*/ |
|
|
public void restart() throws RestartNotSupportedException { |
|
|
final Lifecycle lifecycle = Lifecycle.get(); |
|
|
lifecycle.verifyRestartable(); // verify that Hudson is restartable |
|
|
lifecycle.verifyRestartable(); // verify that Jenkins is restartable |
|
|
servletContext.setAttribute("app", new HudsonIsRestarting()); |
|
|
|
|
|
new Thread("restart thread") { |
|
@@ -3356,9 +3355,9 @@ public void run() { |
|
|
listener.onRestart(); |
|
|
lifecycle.restart(); |
|
|
} catch (InterruptedException e) { |
|
|
LOGGER.log(Level.WARNING, "Failed to restart Hudson",e); |
|
|
LOGGER.log(Level.WARNING, "Failed to restart Jenkins",e); |
|
|
} catch (IOException e) { |
|
|
LOGGER.log(Level.WARNING, "Failed to restart Hudson",e); |
|
|
LOGGER.log(Level.WARNING, "Failed to restart Jenkins",e); |
|
|
} |
|
|
} |
|
|
}.start(); |
|
@@ -3370,7 +3369,7 @@ public void run() { |
|
|
*/ |
|
|
public void safeRestart() throws RestartNotSupportedException { |
|
|
final Lifecycle lifecycle = Lifecycle.get(); |
|
|
lifecycle.verifyRestartable(); // verify that Hudson is restartable |
|
|
lifecycle.verifyRestartable(); // verify that Jenkins is restartable |
|
|
// Quiet down so that we won't launch new builds. |
|
|
isQuietingDown = true; |
|
|
|
|
@@ -4043,7 +4042,7 @@ public void doLaunchSlaveAgent(StaplerRequest req, StaplerResponse rsp) throws I |
|
|
} |
|
|
|
|
|
/** |
|
|
* Live view of recent {@link LogRecord}s produced by Hudson. |
|
|
* Live view of recent {@link LogRecord}s produced by Jenkins. |
|
|
*/ |
|
|
public static List<LogRecord> logRecords = Collections.emptyList(); // initialized to dummy value to avoid NPE |
|
|
|
|
@@ -4099,20 +4098,20 @@ private static void computeVersion(ServletContext context) { |
|
|
} |
|
|
|
|
|
/** |
|
|
* Version number of this Hudson. |
|
|
* Version number of this Jenkins. |
|
|
*/ |
|
|
public static String VERSION="?"; |
|
|
|
|
|
/** |
|
|
* Parses {@link #VERSION} into {@link VersionNumber}, or null if it's not parseable as a version number |
|
|
* (such as when Hudson is run with "mvn hudson-dev:run") |
|
|
* (such as when Jenkins is run with "mvn hudson-dev:run") |
|
|
*/ |
|
|
public static VersionNumber getVersion() { |
|
|
try { |
|
|
return new VersionNumber(VERSION); |
|
|
} catch (NumberFormatException e) { |
|
|
try { |
|
|
// for non-released version of Hudson, this looks like "1.345 (private-foobar), so try to approximate. |
|
|
// for non-released version of Jenkins, this looks like "1.345 (private-foobar), so try to approximate. |
|
|
int idx = VERSION.indexOf(' '); |
|
|
if (idx>0) |
|
|
return new VersionNumber(VERSION.substring(0,idx)); |
|
@@ -4153,7 +4152,7 @@ public static VersionNumber getVersion() { |
|
|
|
|
|
/** |
|
|
* Prefix to resources alongside view scripts. |
|
|
* Strings like "/resources/VERSION", which avoids Hudson to pick up |
|
|
* Strings like "/resources/VERSION", which avoids Jenkins to pick up |
|
|
* stale cache when the user upgrades to a different version. |
|
|
* <p> |
|
|
* Value computed in {@link WebAppMain}. |
|
|