mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-16 13:32:24 +00:00
Merge branch 'stable-2.19' of github.com:jenkinsci/jenkins into stable-2.19
This commit is contained in:
commit
df1f2b2ba4
25 files changed
+498
-57
No files matched your search
@@ -555,7 +555,7 @@ public final class FilePath implements Serializable {
|
||||
* @see #unzip(FilePath)
|
||||
*/
|
||||
public void unzipFrom(InputStream _in) throws IOException, InterruptedException {
|
||||
final InputStream in = new RemoteInputStream(_in);
|
||||
final InputStream in = new RemoteInputStream(_in, Flag.GREEDY);
|
||||
act(new SecureFileCallable<Void>() {
|
||||
public Void invoke(File dir, VirtualChannel channel) throws IOException {
|
||||
unzip(dir, in);
|
||||
@@ -724,7 +724,7 @@ public final class FilePath implements Serializable {
|
||||
*/
|
||||
public void untarFrom(InputStream _in, final TarCompression compression) throws IOException, InterruptedException {
|
||||
try {
|
||||
final InputStream in = new RemoteInputStream(_in);
|
||||
final InputStream in = new RemoteInputStream(_in, Flag.GREEDY);
|
||||
act(new SecureFileCallable<Void>() {
|
||||
public Void invoke(File dir, VirtualChannel channel) throws IOException {
|
||||
readFromTar("input stream",dir, compression.extract(in));
|
||||
|
||||
@@ -862,7 +862,19 @@ public /*transient*/ abstract class Computer extends Actionable implements Acces
|
||||
protected void onRemoved(){
|
||||
}
|
||||
|
||||
private synchronized void setNumExecutors(int n) {
|
||||
/**
|
||||
* Calling path, *means protected by Queue.withLock
|
||||
*
|
||||
* Computer.doConfigSubmit -> Computer.replaceBy ->Jenkins.setNodes* ->Computer.setNode
|
||||
* AbstractCIBase.updateComputerList->Computer.inflictMortalWound*
|
||||
* AbstractCIBase.updateComputerList->AbstractCIBase.updateComputer* ->Computer.setNode
|
||||
* AbstractCIBase.updateComputerList->AbstractCIBase.killComputer->Computer.kill
|
||||
* Computer.constructor->Computer.setNode
|
||||
* Computer.kill is called after numExecutors set to zero(Computer.inflictMortalWound) so not need the Queue.lock
|
||||
*
|
||||
* @param number of executors
|
||||
*/
|
||||
private void setNumExecutors(int n) {
|
||||
this.numExecutors = n;
|
||||
final int diff = executors.size()-n;
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ import hudson.Functions;
|
||||
import hudson.PluginManager;
|
||||
import hudson.PluginWrapper;
|
||||
import hudson.ProxyConfiguration;
|
||||
import hudson.security.ACLContext;
|
||||
import jenkins.util.SystemProperties;
|
||||
import hudson.Util;
|
||||
import hudson.XmlFile;
|
||||
@@ -1365,6 +1366,11 @@ public class UpdateCenter extends AbstractModelObject implements Saveable, OnMas
|
||||
@Exported(inline=true)
|
||||
public volatile RestartJenkinsJobStatus status = new Pending();
|
||||
|
||||
/**
|
||||
* The name of the user that started this job
|
||||
*/
|
||||
private String authentication;
|
||||
|
||||
/**
|
||||
* Cancel job
|
||||
*/
|
||||
@@ -1378,6 +1384,7 @@ public class UpdateCenter extends AbstractModelObject implements Saveable, OnMas
|
||||
|
||||
public RestartJenkinsJob(UpdateSite site) {
|
||||
super(site);
|
||||
this.authentication = Jenkins.getAuthentication().getName();
|
||||
}
|
||||
|
||||
public synchronized void run() {
|
||||
@@ -1386,7 +1393,10 @@ public class UpdateCenter extends AbstractModelObject implements Saveable, OnMas
|
||||
}
|
||||
status = new Running();
|
||||
try {
|
||||
Jenkins.getInstance().safeRestart();
|
||||
// safeRestart records the current authentication for the log, so set it to the managing user
|
||||
try (ACLContext _ = ACL.as(User.get(authentication, false, Collections.emptyMap()))) {
|
||||
Jenkins.getInstance().safeRestart();
|
||||
}
|
||||
} catch (RestartNotSupportedException exception) {
|
||||
// ignore if restart is not allowed
|
||||
status = new Failure();
|
||||
|
||||
@@ -49,6 +49,9 @@ import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
import org.jenkinsci.Symbol;
|
||||
import org.kohsuke.accmod.Restricted;
|
||||
import org.kohsuke.accmod.restrictions.DoNotUse;
|
||||
import org.kohsuke.accmod.restrictions.NoExternalUse;
|
||||
import org.kohsuke.stapler.StaplerRequest;
|
||||
import org.kohsuke.stapler.StaplerResponse;
|
||||
|
||||
@@ -72,6 +75,15 @@ public class GlobalSecurityConfiguration extends ManagementLink implements Descr
|
||||
return Jenkins.getInstance().getSlaveAgentPort();
|
||||
}
|
||||
|
||||
/**
|
||||
* @since TODO
|
||||
* @return true if the slave agent port is enforced on this instance.
|
||||
*/
|
||||
@Restricted(DoNotUse.class) // only for index.groovy
|
||||
public boolean isSlaveAgentPortEnforced() {
|
||||
return Jenkins.getInstance().isSlaveAgentPortEnforced();
|
||||
}
|
||||
|
||||
public Set<String> getAgentProtocols() {
|
||||
return Jenkins.getInstance().getAgentProtocols();
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ public abstract class ComputerListener implements ExtensionPoint {
|
||||
* Starting Hudson 1.312, this method is also invoked for the master, not just for agents.
|
||||
*
|
||||
* @param listener
|
||||
* This is connected to the launch log of the computer.
|
||||
* This is connected to the launch log of the computer or Jenkins master.
|
||||
* Since this method is called synchronously from the thread
|
||||
* that launches a computer, if this method performs a time-consuming
|
||||
* operation, this listener should be notified of the progress.
|
||||
|
||||
@@ -28,6 +28,7 @@ import hudson.Extension;
|
||||
import hudson.model.Node;
|
||||
import hudson.model.TaskListener;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.util.WeakHashMap;
|
||||
import java.util.concurrent.Semaphore;
|
||||
@@ -50,6 +51,9 @@ public class InstallerTranslator extends ToolLocationTranslator {
|
||||
if (isp == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ArrayList<String> inapplicableInstallersMessages = new ArrayList<String>();
|
||||
|
||||
for (ToolInstaller installer : isp.installers) {
|
||||
if (installer.appliesTo(node)) {
|
||||
Semaphore semaphore;
|
||||
@@ -69,8 +73,16 @@ public class InstallerTranslator extends ToolLocationTranslator {
|
||||
} finally {
|
||||
semaphore.release();
|
||||
}
|
||||
} else {
|
||||
inapplicableInstallersMessages.add(Messages.CannotBeInstalled(
|
||||
installer.getDescriptor().getDisplayName(),
|
||||
tool.getName(),
|
||||
node.getDisplayName()));
|
||||
}
|
||||
}
|
||||
for (String message : inapplicableInstallersMessages) {
|
||||
log.getLogger().println(message);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -638,7 +638,7 @@ public abstract class FormValidation extends IOException implements HttpResponse
|
||||
*/
|
||||
public String toStemUrl() {
|
||||
if (names==null) return null;
|
||||
return jsStringEscape(Descriptor.getCurrentDescriptorByNameUrl()) + '/' + relativePath();
|
||||
return Descriptor.getCurrentDescriptorByNameUrl() + '/' + relativePath();
|
||||
}
|
||||
|
||||
public String getDependsOn() {
|
||||
|
||||
@@ -29,6 +29,7 @@ import org.kohsuke.stapler.HttpResponse;
|
||||
import org.kohsuke.stapler.StaplerRequest;
|
||||
import org.kohsuke.stapler.StaplerResponse;
|
||||
|
||||
import javax.annotation.CheckForNull;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.servlet.ServletException;
|
||||
import java.io.File;
|
||||
|
||||
@@ -20,6 +20,7 @@ import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletRequestWrapper;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import jenkins.util.SystemProperties;
|
||||
import org.acegisecurity.Authentication;
|
||||
import org.acegisecurity.context.SecurityContextHolder;
|
||||
import org.acegisecurity.providers.UsernamePasswordAuthenticationToken;
|
||||
@@ -117,9 +118,9 @@ public class SetupWizard extends PageDecorator {
|
||||
authStrategy.setAllowAnonymousRead(false);
|
||||
jenkins.setAuthorizationStrategy(authStrategy);
|
||||
|
||||
// Shut down all the ports we can by default:
|
||||
jenkins.setSlaveAgentPort(-1); // -1 to disable
|
||||
|
||||
// Disable jnlp by default, but honor system properties
|
||||
jenkins.setSlaveAgentPort(SystemProperties.getInteger(Jenkins.class.getName()+".slaveAgentPort",-1));
|
||||
|
||||
// require a crumb issuer
|
||||
jenkins.setCrumbIssuer(new DefaultCrumbIssuer(false));
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ import antlr.ANTLRException;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Injector;
|
||||
import com.thoughtworks.xstream.XStream;
|
||||
import hudson.BulkChange;
|
||||
@@ -596,7 +597,16 @@ public class Jenkins extends AbstractCIBase implements DirectlyModifiableTopLeve
|
||||
* TCP agent port.
|
||||
* 0 for random, -1 to disable.
|
||||
*/
|
||||
private int slaveAgentPort = SystemProperties.getInteger(Jenkins.class.getName()+".slaveAgentPort",0);
|
||||
private int slaveAgentPort = getSlaveAgentPortInitialValue(0);
|
||||
|
||||
private static int getSlaveAgentPortInitialValue(int def) {
|
||||
return SystemProperties.getInteger(Jenkins.class.getName()+".slaveAgentPort", def);
|
||||
}
|
||||
|
||||
/**
|
||||
* If -Djenkins.model.Jenkins.slaveAgentPort is defined, enforce it on every start instead of only the first one.
|
||||
*/
|
||||
private static final boolean SLAVE_AGENT_PORT_ENFORCE = SystemProperties.getBoolean(Jenkins.class.getName()+".slaveAgentPortEnforce", false);
|
||||
|
||||
/**
|
||||
* The TCP agent protocols that are explicitly disabled (we store the disabled ones so that newer protocols
|
||||
@@ -606,6 +616,11 @@ public class Jenkins extends AbstractCIBase implements DirectlyModifiableTopLeve
|
||||
*/
|
||||
@CheckForNull
|
||||
private List<String> disabledAgentProtocols;
|
||||
/**
|
||||
* @deprecated Just a temporary buffer for XSTream migration code from JENKINS-39465, do not use
|
||||
*/
|
||||
@Deprecated
|
||||
private transient String[] _disabledAgentProtocols;
|
||||
|
||||
/**
|
||||
* The TCP agent protocols that are {@link AgentProtocol#isOptIn()} and explicitly enabled.
|
||||
@@ -615,6 +630,11 @@ public class Jenkins extends AbstractCIBase implements DirectlyModifiableTopLeve
|
||||
*/
|
||||
@CheckForNull
|
||||
private List<String> enabledAgentProtocols;
|
||||
/**
|
||||
* @deprecated Just a temporary buffer for XSTream migration code from JENKINS-39465, do not use
|
||||
*/
|
||||
@Deprecated
|
||||
private transient String[] _enabledAgentProtocols;
|
||||
|
||||
/**
|
||||
* The TCP agent protocols that are enabled. Built from {@link #disabledAgentProtocols} and
|
||||
@@ -947,11 +967,25 @@ public class Jenkins extends AbstractCIBase implements DirectlyModifiableTopLeve
|
||||
|
||||
updateComputerList();
|
||||
|
||||
{// master is online now
|
||||
Computer c = toComputer();
|
||||
if(c!=null)
|
||||
for (ComputerListener cl : ComputerListener.all())
|
||||
cl.onOnline(c, new LogTaskListener(LOGGER, INFO));
|
||||
{// master is online now, it's instance must always exist
|
||||
final Computer c = toComputer();
|
||||
if(c != null) {
|
||||
for (ComputerListener cl : ComputerListener.all()) {
|
||||
try {
|
||||
cl.onOnline(c, new LogTaskListener(LOGGER, INFO));
|
||||
} catch (Throwable t) {
|
||||
if (t instanceof Error) {
|
||||
// We propagate Runtime errors, because they are fatal.
|
||||
throw t;
|
||||
}
|
||||
|
||||
// Other exceptions should be logged instead of failing the Jenkins startup (See listener's Javadoc)
|
||||
// We also throw it for InterruptedException since it's what is expected according to the javadoc
|
||||
LOGGER.log(SEVERE, String.format("Invocation of the computer listener %s failed for the Jenkins master node",
|
||||
cl.getClass()), t);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (ItemListener l : ItemListener.all()) {
|
||||
@@ -982,6 +1016,19 @@ public class Jenkins extends AbstractCIBase implements DirectlyModifiableTopLeve
|
||||
if (jdks == null) {
|
||||
jdks = new ArrayList<>();
|
||||
}
|
||||
if (SLAVE_AGENT_PORT_ENFORCE) {
|
||||
slaveAgentPort = getSlaveAgentPortInitialValue(slaveAgentPort);
|
||||
}
|
||||
if (disabledAgentProtocols == null && _disabledAgentProtocols != null) {
|
||||
disabledAgentProtocols = Arrays.asList(_disabledAgentProtocols);
|
||||
_disabledAgentProtocols = null;
|
||||
}
|
||||
if (enabledAgentProtocols == null && _enabledAgentProtocols != null) {
|
||||
enabledAgentProtocols = Arrays.asList(_enabledAgentProtocols);
|
||||
_enabledAgentProtocols = null;
|
||||
}
|
||||
// Invalidate the protocols cache after the reload
|
||||
agentProtocols = null;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -1091,11 +1138,26 @@ public class Jenkins extends AbstractCIBase implements DirectlyModifiableTopLeve
|
||||
return slaveAgentPort;
|
||||
}
|
||||
|
||||
/**
|
||||
* @since TODO
|
||||
*/
|
||||
public boolean isSlaveAgentPortEnforced() {
|
||||
return Jenkins.SLAVE_AGENT_PORT_ENFORCE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param port
|
||||
* 0 to indicate random available TCP port. -1 to disable this service.
|
||||
*/
|
||||
public void setSlaveAgentPort(int port) throws IOException {
|
||||
if (SLAVE_AGENT_PORT_ENFORCE) {
|
||||
LOGGER.log(Level.WARNING, "setSlaveAgentPort({0}) call ignored because system property {1} is true", new String[] { Integer.toString(port), Jenkins.class.getName()+".slaveAgentPortEnforce" });
|
||||
} else {
|
||||
forceSetSlaveAgentPort(port);
|
||||
}
|
||||
}
|
||||
|
||||
private void forceSetSlaveAgentPort(int port) throws IOException {
|
||||
this.slaveAgentPort = port;
|
||||
launchTcpSlaveAgentListener();
|
||||
}
|
||||
@@ -1206,6 +1268,38 @@ public class Jenkins extends AbstractCIBase implements DirectlyModifiableTopLeve
|
||||
}
|
||||
}
|
||||
|
||||
@Extension
|
||||
@Restricted(NoExternalUse.class)
|
||||
public static class EnforceSlaveAgentPortAdministrativeMonitor extends AdministrativeMonitor {
|
||||
@Inject
|
||||
Jenkins j;
|
||||
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
return jenkins.model.Messages.EnforceSlaveAgentPortAdministrativeMonitor_displayName();
|
||||
}
|
||||
|
||||
public String getSystemPropertyName() {
|
||||
return Jenkins.class.getName() + ".slaveAgentPort";
|
||||
}
|
||||
|
||||
public int getExpectedPort() {
|
||||
int slaveAgentPort = j.slaveAgentPort;
|
||||
return Jenkins.getSlaveAgentPortInitialValue(slaveAgentPort);
|
||||
}
|
||||
|
||||
public void doAct(StaplerRequest req, StaplerResponse rsp) throws IOException {
|
||||
j.forceSetSlaveAgentPort(getExpectedPort());
|
||||
rsp.sendRedirect2(req.getContextPath() + "/manage");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActivated() {
|
||||
int slaveAgentPort = Jenkins.getInstance().slaveAgentPort;
|
||||
return SLAVE_AGENT_PORT_ENFORCE && slaveAgentPort != Jenkins.getSlaveAgentPortInitialValue(slaveAgentPort);
|
||||
}
|
||||
}
|
||||
|
||||
public void setNodeName(String name) {
|
||||
throw new UnsupportedOperationException(); // not allowed
|
||||
}
|
||||
@@ -4949,8 +5043,8 @@ public class Jenkins extends AbstractCIBase implements DirectlyModifiableTopLeve
|
||||
// for backward compatibility with <1.75, recognize the tag name "view" as well.
|
||||
XSTREAM.alias("view", ListView.class);
|
||||
XSTREAM.alias("listView", ListView.class);
|
||||
XSTREAM.addImplicitCollection(Jenkins.class, "disabledAgentProtocols", "disabledAgentProtocol", String.class);
|
||||
XSTREAM.addImplicitCollection(Jenkins.class, "enabledAgentProtocols", "enabledAgentProtocol", String.class);
|
||||
XSTREAM.addImplicitArray(Jenkins.class, "_disabledAgentProtocols", "disabledAgentProtocol");
|
||||
XSTREAM.addImplicitArray(Jenkins.class, "_enabledAgentProtocols", "enabledAgentProtocol");
|
||||
XSTREAM2.addCriticalField(Jenkins.class, "securityRealm");
|
||||
XSTREAM2.addCriticalField(Jenkins.class, "authorizationStrategy");
|
||||
// this seems to be necessary to force registration of converter early enough
|
||||
|
||||
@@ -27,12 +27,16 @@ import net.sf.json.JSONObject;
|
||||
import org.kohsuke.accmod.Restricted;
|
||||
import org.kohsuke.accmod.restrictions.NoExternalUse;
|
||||
|
||||
import javax.annotation.CheckForNull;
|
||||
import javax.annotation.Nonnull;
|
||||
import hudson.PluginWrapper;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.MissingResourceException;
|
||||
import java.util.ResourceBundle;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import jenkins.model.Jenkins;
|
||||
|
||||
/**
|
||||
* Simple {@link java.util.ResourceBundle} utility class.
|
||||
@@ -42,6 +46,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
@Restricted(NoExternalUse.class)
|
||||
public class ResourceBundleUtil {
|
||||
|
||||
private static final Logger logger = Logger.getLogger("jenkins.util.ResourceBundle");
|
||||
private static final Map<String, JSONObject> bundles = new ConcurrentHashMap<>();
|
||||
|
||||
private ResourceBundleUtil() {
|
||||
@@ -72,7 +77,23 @@ public class ResourceBundleUtil {
|
||||
return bundleJSON;
|
||||
}
|
||||
|
||||
ResourceBundle bundle = ResourceBundle.getBundle(baseName, locale);
|
||||
ResourceBundle bundle = getBundle(baseName, locale, Jenkins.class.getClassLoader());
|
||||
if (bundle == null) {
|
||||
// Not in Jenkins core. Check the plugins.
|
||||
Jenkins jenkins = Jenkins.getInstance(); // will never return null
|
||||
if (jenkins != null) {
|
||||
for (PluginWrapper plugin : jenkins.getPluginManager().getPlugins()) {
|
||||
bundle = getBundle(baseName, locale, plugin.classLoader);
|
||||
if (bundle != null) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (bundle == null) {
|
||||
throw new MissingResourceException("Can't find bundle for base name "
|
||||
+ baseName + ", locale " + locale, baseName + "_" + locale, "");
|
||||
}
|
||||
|
||||
bundleJSON = toJSONObject(bundle);
|
||||
bundles.put(bundleKey, bundleJSON);
|
||||
@@ -80,6 +101,30 @@ public class ResourceBundleUtil {
|
||||
return bundleJSON;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a plugin bundle using the supplied Locale and classLoader
|
||||
*
|
||||
* @param baseName The bundle base name.
|
||||
* @param locale The Locale.
|
||||
* @param classLoader The classLoader
|
||||
* @return The bundle JSON.
|
||||
*/
|
||||
private static @CheckForNull ResourceBundle getBundle(@Nonnull String baseName, @Nonnull Locale locale, @Nonnull ClassLoader classLoader) {
|
||||
try {
|
||||
return ResourceBundle.getBundle(baseName, locale, classLoader);
|
||||
} catch (MissingResourceException e) {
|
||||
// fall through and return null.
|
||||
logger.finer(e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a JSON representation of a resource bundle
|
||||
*
|
||||
* @param bundle The resource bundle.
|
||||
* @return The bundle JSON.
|
||||
*/
|
||||
private static JSONObject toJSONObject(@Nonnull ResourceBundle bundle) {
|
||||
JSONObject json = new JSONObject();
|
||||
for (String key : bundle.keySet()) {
|
||||
|
||||
@@ -41,35 +41,42 @@ THE SOFTWARE.
|
||||
<j:invokeStatic var="tz" className="java.util.TimeZone" method="getDefault"/>
|
||||
var tz = ${(tz.rawOffset + tz.DSTSavings) / 3600000};
|
||||
var tl = null;
|
||||
var interval = 24*60*60*1000;
|
||||
<![CDATA[
|
||||
function getData(eventSource1, current, min, max) {
|
||||
if (current < min) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!eventSource1.loaded[current]) {
|
||||
eventSource1.loaded[current] = true;
|
||||
new Ajax.Request("timeline/data/",{
|
||||
method:"POST",
|
||||
parameters: {min: current*interval, max:(current+1)*interval},
|
||||
onSuccess: function(t) {
|
||||
if (t.status != 0) {
|
||||
try {
|
||||
eventSource1.loadJSON(eval('('+t.responseText+')'),'.');
|
||||
getData(eventSource1, current-1, min, max);
|
||||
} catch (e) {
|
||||
alert(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function doLoad() {
|
||||
var tl_el = document.getElementById("tl");
|
||||
var eventSource1 = new Timeline.DefaultEventSource();
|
||||
eventSource1.loaded = {};
|
||||
var interval = 24*60*60*1000;
|
||||
eventSource1.ensureVisible = function(band) {
|
||||
// make sure all data are loaded for the portion visible in the band
|
||||
// $('status').innerHTML = "min="+band.getMinDate()+" max="+band.getMaxDate();
|
||||
var min = Math.floor(band.getMinDate().getTime()/interval);
|
||||
var max = Math.ceil(band.getMaxDate().getTime()/interval);
|
||||
for (var i=min; i<=max; i++) {
|
||||
if (!this.loaded[i]) {
|
||||
this.loaded[i] = true;
|
||||
new Ajax.Request("timeline/data/",{
|
||||
method:"POST",
|
||||
parameters: {min: i*interval, max:(i+1)*interval},
|
||||
onSuccess: function(t) {
|
||||
if (t.status != 0) {
|
||||
try {
|
||||
eventSource1.loadJSON(eval('('+t.responseText+')'),'.');
|
||||
} catch (e) {
|
||||
alert(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
var min = Math.floor(band.getMinVisibleDate().getTime()/interval);
|
||||
var max = Math.ceil(band.getMaxVisibleDate().getTime()/interval);
|
||||
getData(eventSource1, max, min, max);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ THE SOFTWARE.
|
||||
<t:editableDescription permission="${app.ADMINISTER}"/>
|
||||
</j:if>
|
||||
|
||||
<j:forEach var="a" items="${it.actions}">
|
||||
<j:forEach var="a" items="${it.allActions}">
|
||||
<st:include page="summary.jelly" from="${a}" optional="true" it="${a}" />
|
||||
</j:forEach>
|
||||
|
||||
|
||||
@@ -26,8 +26,18 @@ l.layout(norefresh:true, permission:app.ADMINISTER, title:my.displayName, csscla
|
||||
set("descriptor", my.descriptor);
|
||||
|
||||
f.optionalBlock( field:"useSecurity", title:_("Enable security"), checked:app.useSecurity) {
|
||||
f.entry (title:_("TCP port for JNLP agents"), field:"slaveAgentPort") {
|
||||
f.serverTcpPort()
|
||||
f.entry(title: _("TCP port for JNLP agents"), field: "slaveAgentPort") {
|
||||
if (my.slaveAgentPortEnforced) {
|
||||
if (my.slaveAgentPort == -1) {
|
||||
text(_("slaveAgentPortEnforcedDisabled"))
|
||||
} else if (my.slaveAgentPort == 0) {
|
||||
text(_("slaveAgentPortEnforcedRandom"))
|
||||
} else {
|
||||
text(_("slaveAgentPortEnforced", my.slaveAgentPort))
|
||||
}
|
||||
} else {
|
||||
f.serverTcpPort()
|
||||
}
|
||||
}
|
||||
f.advanced(title: _("Agent protocols"), align:"left") {
|
||||
f.entry(title: _("Agent protocols")) {
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
slaveAgentPortEnforced=enforced to {0,number,#} on startup through system property.
|
||||
slaveAgentPortEnforcedRandom=enforced to random port on startup through system property.
|
||||
slaveAgentPortEnforcedDisabled=disabled on startup through system property.
|
||||
@@ -37,3 +37,4 @@ JDKInstaller.DescriptorImpl.displayName=Install from java.sun.com
|
||||
JDKInstaller.DescriptorImpl.doCheckId=Define JDK ID
|
||||
JDKInstaller.DescriptorImpl.doCheckAcceptLicense=You must agree to the license to download the JDK.
|
||||
ToolDescriptor.NotADirectory={0} is not a directory on the Jenkins master (but perhaps it exists on some agents)
|
||||
CannotBeInstalled=Installer "{0}" cannot be used to install "{1}" on the node "{2}"
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
<!--
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2016, CloudBees, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
-->
|
||||
<?jelly escape-by-default='true'?>
|
||||
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:i="jelly:fmt">
|
||||
<div class="warning">
|
||||
${%description(it.systemPropertyName, it.expectedPort)}
|
||||
<form method="post" action="${rootURL}/${it.url}/act" name="${it.id}">
|
||||
<div style="float:right">
|
||||
<f:submit name="reset" value="${%reset(it.expectedPort)}"/>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</j:jelly>
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
description=JNLP Agent Port has been changed but was specified through system property {0} on startup. Its value will be reset to {1,number,#} on restart.
|
||||
reset=Reset to {0,number,#}
|
||||
@@ -68,3 +68,5 @@ ParameterizedJobMixIn.build_now=Build Now
|
||||
BlockedBecauseOfBuildInProgress.shortDescription=Build #{0} is already in progress{1}
|
||||
BlockedBecauseOfBuildInProgress.ETA=\ (ETA:{0})
|
||||
BuildDiscarderProperty.displayName=Discard old builds
|
||||
|
||||
EnforceSlaveAgentPortAdministrativeMonitor.displayName=Enforce JNLP Slave Agent Port
|
||||
@@ -0,0 +1,5 @@
|
||||
td.setting-main .CodeMirror {
|
||||
display: table;
|
||||
table-layout: fixed;
|
||||
width: 100%;
|
||||
}
|
||||
@@ -35,6 +35,8 @@ import hudson.slaves.RetentionStrategy;
|
||||
import hudson.tasks.Shell;
|
||||
import hudson.util.StreamTaskListener;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.*;
|
||||
@@ -98,4 +100,41 @@ public class InstallerTranslatorTest {
|
||||
r.assertLogContains("/opt/jdk1", b6);
|
||||
}
|
||||
|
||||
@Issue("JENKINS-26940")
|
||||
@Test
|
||||
public void testMessageLoggedWhenNoInstallerFound() throws Exception {
|
||||
final CommandInstaller ci = new CommandInstaller("wrong1", "echo hello", "/opt/jdk");
|
||||
final BatchCommandInstaller bci = new BatchCommandInstaller("wrong2", "echo hello", "/opt/jdk2");
|
||||
InstallSourceProperty isp = new InstallSourceProperty(Arrays.asList(ci, bci));
|
||||
|
||||
JDK jdk = new JDK("jdk", null, Collections.singletonList(isp));
|
||||
r.jenkins.getJDKs().add(jdk);
|
||||
|
||||
|
||||
FreeStyleProject p = r.createFreeStyleProject();
|
||||
p.setJDK(jdk);
|
||||
p.getBuildersList().add(new Shell("echo $JAVA_HOME"));
|
||||
FreeStyleBuild b1 = r.buildAndAssertSuccess(p);
|
||||
r.assertLogContains(hudson.tools.Messages.CannotBeInstalled(ci.getDescriptor().getDisplayName(), jdk.getName(), r.jenkins.getDisplayName()), b1);
|
||||
r.assertLogContains(hudson.tools.Messages.CannotBeInstalled(bci.getDescriptor().getDisplayName(), jdk.getName(), r.jenkins.getDisplayName()), b1);
|
||||
}
|
||||
|
||||
@Issue("JENKINS-26940")
|
||||
@Test
|
||||
public void testNoMessageLoggedWhenAnyInstallerFound() throws Exception {
|
||||
final CommandInstaller ci = new CommandInstaller("wrong1", "echo hello", "/opt/jdk");
|
||||
final CommandInstaller ci2 = new CommandInstaller("master", "echo hello", "/opt/jdk2");
|
||||
InstallSourceProperty isp = new InstallSourceProperty(Arrays.asList(ci, ci2));
|
||||
|
||||
JDK jdk = new JDK("jdk", null, Collections.singletonList(isp));
|
||||
r.jenkins.getJDKs().add(jdk);
|
||||
|
||||
|
||||
FreeStyleProject p = r.createFreeStyleProject();
|
||||
p.setJDK(jdk);
|
||||
p.getBuildersList().add(new Shell("echo $JAVA_HOME"));
|
||||
FreeStyleBuild b1 = r.buildAndAssertSuccess(p);
|
||||
r.assertLogNotContains(ci.getDescriptor().getDisplayName(), b1);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -23,6 +23,7 @@
|
||||
*/
|
||||
package jenkins;
|
||||
|
||||
import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Rule;
|
||||
@@ -31,6 +32,7 @@ import org.jvnet.hudson.test.JenkinsRule;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import java.io.IOException;
|
||||
import org.jvnet.hudson.test.Issue;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:tom.fennelly@gmail.com">tom.fennelly@gmail.com</a>
|
||||
@@ -49,9 +51,22 @@ public class I18nTest {
|
||||
|
||||
@Test
|
||||
public void test_baseName_unknown() throws IOException, SAXException {
|
||||
JSONObject response = jenkinsRule.getJSON("i18n/resourceBundle?baseName=com.acme.XyzWhatever").getJSONObject();
|
||||
Assert.assertEquals("error", response.getString("status"));
|
||||
Assert.assertTrue(response.getString("message").contains("com.acme.XyzWhatever"));
|
||||
try {
|
||||
JSONObject response = jenkinsRule.getJSON("i18n/resourceBundle?baseName=com.acme.XyzWhatever").getJSONObject();
|
||||
} catch (FailingHttpStatusCodeException e) {
|
||||
Assert.assertNotNull(e);
|
||||
Assert.assertTrue(e.getMessage().contains("com.acme.XyzWhatever"));
|
||||
}
|
||||
}
|
||||
|
||||
@Issue("JENKINS-35270")
|
||||
@Test
|
||||
public void test_baseName_plugin() throws IOException, SAXException {
|
||||
// ssh-slaves plugin is installed by default
|
||||
JSONObject response = jenkinsRule.getJSON("i18n/resourceBundle?baseName=hudson.plugins.sshslaves.Messages").getJSONObject();
|
||||
Assert.assertEquals("ok", response.getString("status"));
|
||||
JSONObject data = response.getJSONObject("data");
|
||||
Assert.assertEquals("The launch timeout must be a number.", data.getString("SSHConnector.LaunchTimeoutMustBeANumber"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -25,7 +25,10 @@ package jenkins.model;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.greaterThan;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.hasItem;
|
||||
import static org.hamcrest.Matchers.not;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
@@ -42,6 +45,7 @@ import com.gargoylesoftware.htmlunit.html.HtmlPage;
|
||||
|
||||
import hudson.maven.MavenModuleSet;
|
||||
import hudson.maven.MavenModuleSetBuild;
|
||||
import hudson.model.Computer;
|
||||
import hudson.model.Failure;
|
||||
import hudson.model.RestartListener;
|
||||
import hudson.model.RootAction;
|
||||
@@ -51,6 +55,7 @@ import hudson.security.FullControlOnceLoggedInAuthorizationStrategy;
|
||||
import hudson.security.HudsonPrivateSecurityRealm;
|
||||
import hudson.util.HttpResponses;
|
||||
import hudson.model.FreeStyleProject;
|
||||
import hudson.model.TaskListener;
|
||||
import hudson.security.GlobalMatrixAuthorizationStrategy;
|
||||
import hudson.security.LegacySecurityRealm;
|
||||
import hudson.security.Permission;
|
||||
@@ -59,6 +64,7 @@ import hudson.slaves.DumbSlave;
|
||||
import hudson.slaves.OfflineCause;
|
||||
import hudson.util.FormValidation;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.jvnet.hudson.test.Issue;
|
||||
@@ -70,8 +76,15 @@ import org.kohsuke.stapler.HttpResponse;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
import org.junit.Assume;
|
||||
|
||||
/**
|
||||
* @author kingfai
|
||||
@@ -452,4 +465,133 @@ public class JenkinsTest {
|
||||
assertThat(rsp.getContentAsString(), containsString("Node is offline"));
|
||||
assertThat(rsp.getStatusCode(), equalTo(404));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Issue("JENKINS-38487")
|
||||
public void startupShouldNotFailOnFailingOnlineListener() {
|
||||
// We do nothing, FailingOnOnlineListener & JenkinsRule should cause the
|
||||
// boot failure if the issue is not fixed.
|
||||
}
|
||||
|
||||
@TestExtension(value = "startupShouldNotFailOnFailingOnlineListener")
|
||||
public static final class FailingOnOnlineListener extends ComputerListener {
|
||||
|
||||
@Override
|
||||
public void onOnline(Computer c, TaskListener listener) throws IOException, InterruptedException {
|
||||
throw new IOException("Something happened (the listener always throws this exception)");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Issue("JENKINS-39465")
|
||||
public void agentProtocols_singleEnable_roundtrip() throws Exception {
|
||||
final Set<String> defaultProtocols = Collections.unmodifiableSet(j.jenkins.getAgentProtocols());
|
||||
Assume.assumeThat("We assume that JNLP3-connect is disabled",
|
||||
defaultProtocols, not(hasItem("JNLP3-connect")));
|
||||
|
||||
final Set<String> newProtocols = new HashSet<>(defaultProtocols);
|
||||
newProtocols.add("JNLP3-connect");
|
||||
j.jenkins.setAgentProtocols(newProtocols);
|
||||
j.jenkins.save();
|
||||
final Set<String> agentProtocolsBeforeReload = j.jenkins.getAgentProtocols();
|
||||
assertThat("JNLP3-connect must be enabled before the roundtrip",
|
||||
j.jenkins.getAgentProtocols(), hasItem("JNLP3-connect"));
|
||||
|
||||
j.jenkins.reload();
|
||||
|
||||
final Set<String> reloadedProtocols = j.jenkins.getAgentProtocols();
|
||||
assertFalse("The protocol list must have been really reloaded", agentProtocolsBeforeReload == reloadedProtocols);
|
||||
assertThat("We should have additional enabled protocol",
|
||||
reloadedProtocols.size(), equalTo(defaultProtocols.size() + 1));
|
||||
assertThat("JNLP3-connect must be enabled after the roundtrip",
|
||||
reloadedProtocols, hasItem("JNLP3-connect"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Issue("JENKINS-39465")
|
||||
public void agentProtocols_multipleDisable_roundtrip() throws Exception {
|
||||
final Set<String> defaultProtocols = Collections.unmodifiableSet(j.jenkins.getAgentProtocols());
|
||||
Assume.assumeThat("At least one protocol is enabled", defaultProtocols.size(), greaterThan(0));
|
||||
|
||||
final String protocolToDisable = defaultProtocols.iterator().next();
|
||||
|
||||
final Set<String> newProtocols = new HashSet<>(defaultProtocols);
|
||||
newProtocols.remove(protocolToDisable);
|
||||
j.jenkins.setAgentProtocols(newProtocols);
|
||||
j.jenkins.save();
|
||||
assertThat(protocolToDisable + " must be disabled before the roundtrip",
|
||||
j.jenkins.getAgentProtocols(), not(hasItem(protocolToDisable)));
|
||||
final Set<String> agentProtocolsBeforeReload = j.jenkins.getAgentProtocols();
|
||||
j.jenkins.reload();
|
||||
|
||||
assertFalse("The protocol list must have been really refreshed", agentProtocolsBeforeReload == j.jenkins.getAgentProtocols());
|
||||
assertThat("We should have disabled one protocol",
|
||||
j.jenkins.getAgentProtocols().size(), equalTo(defaultProtocols.size() - 1));
|
||||
assertThat(protocolToDisable + " must be disabled after the roundtrip",
|
||||
j.jenkins.getAgentProtocols(), not(hasItem(protocolToDisable)));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Issue("JENKINS-39465")
|
||||
@Ignore("No JNLP4 for 2.19.3")
|
||||
public void agentProtocols_multipleEnable_roundtrip() throws Exception {
|
||||
final Set<String> defaultProtocols = Collections.unmodifiableSet(j.jenkins.getAgentProtocols());
|
||||
Assume.assumeThat("We assume that JNLP3-connect is disabled",
|
||||
defaultProtocols, not(hasItem("JNLP3-connect")));
|
||||
Assume.assumeThat("We assume that JNLP4-connect is disabled",
|
||||
defaultProtocols, not(hasItem("JNLP4-connect")));
|
||||
|
||||
final Set<String> newProtocols = new HashSet<>(defaultProtocols);
|
||||
newProtocols.add("JNLP3-connect");
|
||||
newProtocols.add("JNLP4-connect");
|
||||
j.jenkins.setAgentProtocols(newProtocols);
|
||||
j.jenkins.save();
|
||||
final Set<String> agentProtocolsBeforeReload = j.jenkins.getAgentProtocols();
|
||||
assertThat("JNLP3-connect must be enabled before the roundtrip",
|
||||
j.jenkins.getAgentProtocols(), hasItem("JNLP3-connect"));
|
||||
assertThat("JNLP4-connect must be enabled before the roundtrip",
|
||||
j.jenkins.getAgentProtocols(), hasItem("JNLP4-connect"));
|
||||
|
||||
j.jenkins.reload();
|
||||
|
||||
final Set<String> reloadedProtocols = j.jenkins.getAgentProtocols();
|
||||
assertFalse("The protocol list must have been really reloaded", agentProtocolsBeforeReload == reloadedProtocols);
|
||||
assertThat("We should have two additional enabled protocols",
|
||||
reloadedProtocols.size(), equalTo(defaultProtocols.size() + 2));
|
||||
assertThat("JNLP3-connect must be enabled after the roundtrip",
|
||||
reloadedProtocols, hasItem("JNLP3-connect"));
|
||||
assertThat("JNLP3-connect must be enabled after the roundtrip",
|
||||
reloadedProtocols, hasItem("JNLP4-connect"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Issue("JENKINS-39465")
|
||||
public void agentProtocols_singleDisable_roundtrip() throws Exception {
|
||||
final Set<String> defaultProtocols = Collections.unmodifiableSet(j.jenkins.getAgentProtocols());
|
||||
Assume.assumeThat("At least two protocol should be enabled", defaultProtocols.size(), greaterThan(1));
|
||||
|
||||
Iterator<String> iterator = defaultProtocols.iterator();
|
||||
final String protocolToDisable1 = iterator.next();
|
||||
final String protocolToDisable2 = iterator.next();
|
||||
|
||||
final Set<String> newProtocols = new HashSet<>(defaultProtocols);
|
||||
newProtocols.remove(protocolToDisable1);
|
||||
newProtocols.remove(protocolToDisable2);
|
||||
j.jenkins.setAgentProtocols(newProtocols);
|
||||
j.jenkins.save();
|
||||
assertThat(protocolToDisable1 + " must be disabled before the roundtrip",
|
||||
j.jenkins.getAgentProtocols(), not(hasItem(protocolToDisable1)));
|
||||
assertThat(protocolToDisable2 + " must be disabled before the roundtrip",
|
||||
j.jenkins.getAgentProtocols(), not(hasItem(protocolToDisable2)));
|
||||
final Set<String> agentProtocolsBeforeReload = j.jenkins.getAgentProtocols();
|
||||
j.jenkins.reload();
|
||||
|
||||
assertFalse("The protocol list must have been really reloaded", agentProtocolsBeforeReload == j.jenkins.getAgentProtocols());
|
||||
assertThat("We should have disabled two protocols",
|
||||
j.jenkins.getAgentProtocols().size(), equalTo(defaultProtocols.size() - 2));
|
||||
assertThat(protocolToDisable1 + " must be disaabled after the roundtrip",
|
||||
j.jenkins.getAgentProtocols(), not(hasItem(protocolToDisable1)));
|
||||
assertThat(protocolToDisable2 + " must be disaabled after the roundtrip",
|
||||
j.jenkins.getAgentProtocols(), not(hasItem(protocolToDisable2)));
|
||||
}
|
||||
}
|
||||
@@ -107,7 +107,6 @@ $.when(getItems()).done(function(data) {
|
||||
btn.removeClass('disabled');
|
||||
btn.prop('disabled', false);
|
||||
}
|
||||
btn.focus();
|
||||
} else {
|
||||
if (!btn.hasClass('disabled')) {
|
||||
btn.addClass('disabled');
|
||||
@@ -233,7 +232,7 @@ $.when(getItems()).done(function(data) {
|
||||
$("#add-item-panel").find("#name").focus();
|
||||
|
||||
// Init NameField
|
||||
$('input[name="name"]', '#createItem').blur(function() {
|
||||
$('input[name="name"]', '#createItem').on("blur input", function() {
|
||||
if (!isItemNameEmpty()) {
|
||||
var itemName = $('input[name="name"]', '#createItem').val();
|
||||
$.get("checkJobName", { value: itemName }).done(function(data) {
|
||||
|
||||
@@ -1486,6 +1486,7 @@ function expandTextArea(button,id) {
|
||||
// refresh a part of the HTML specified by the given ID,
|
||||
// by using the contents fetched from the given URL.
|
||||
function refreshPart(id,url) {
|
||||
var intervalID = null;
|
||||
var f = function() {
|
||||
if(isPageVisible()) {
|
||||
new Ajax.Request(url, {
|
||||
@@ -1493,6 +1494,8 @@ function refreshPart(id,url) {
|
||||
var hist = $(id);
|
||||
if (hist == null) {
|
||||
console.log("There's no element that has ID of " + id);
|
||||
if (intervalID !== null)
|
||||
window.clearInterval(intervalID);
|
||||
return;
|
||||
}
|
||||
var p = hist.up();
|
||||
@@ -1505,22 +1508,14 @@ function refreshPart(id,url) {
|
||||
|
||||
Behaviour.applySubtree(node);
|
||||
layoutUpdateCallback.call();
|
||||
|
||||
if(isRunAsTest) return;
|
||||
refreshPart(id,url);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// Reschedule
|
||||
if(isRunAsTest) return;
|
||||
refreshPart(id,url);
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
// if run as test, just do it once and do it now to make sure it's working,
|
||||
// but don't repeat.
|
||||
if(isRunAsTest) f();
|
||||
else window.setTimeout(f, 5000);
|
||||
else intervalID = window.setInterval(f, 5000);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user