mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-16 05:22:22 +00:00
Merge branch 'master' of https://github.com/jenkinsci/jenkins
This commit is contained in:
commit
e6be820b66
22 files changed
+176
-74
No files matched your search
+9
-2
@@ -55,7 +55,14 @@ Upcoming changes</a>
|
||||
<!-- Record your changes in the trunk here. -->
|
||||
<div id="trunk" style="display:none"><!--=TRUNK-BEGIN=-->
|
||||
<ul class=image>
|
||||
<li class=>
|
||||
<li class='major bug'>
|
||||
Saving Global Jenkins Global Config wipes out the crumb issuer settings in the Global Security Config.
|
||||
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-17087">issue 17087</a>)
|
||||
<li class=bug>
|
||||
Preview function for textareas using Jenkins markup did not work when CSRF protection was enabled.
|
||||
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-17085">issue 17085</a>)
|
||||
<li class=rfe>
|
||||
Improved the duration browsers cache static resources.
|
||||
</ul>
|
||||
</div><!--=TRUNK-END=-->
|
||||
|
||||
@@ -79,7 +86,7 @@ Upcoming changes</a>
|
||||
Absolute URLs in console output
|
||||
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-16368">issue 16368</a>)
|
||||
<li class=bug>
|
||||
Revert ampersand encoding which can cause backwad incompatibility issue
|
||||
Revert ampersand encoding which can cause backward incompatibility issue
|
||||
(<a href="https://github.com/jenkinsci/jenkins/pull/683">pull 683</a>)
|
||||
<li class=bug>
|
||||
Fix dependency graph computation when upstream build trigger is involved
|
||||
|
||||
+2
-2
@@ -42,7 +42,7 @@ THE SOFTWARE.
|
||||
|
||||
<properties>
|
||||
<staplerFork>true</staplerFork>
|
||||
<stapler.version>1.199</stapler.version>
|
||||
<stapler.version>1.205</stapler.version>
|
||||
<spring.version>2.5.6.SEC03</spring.version>
|
||||
</properties>
|
||||
|
||||
@@ -199,7 +199,7 @@ THE SOFTWARE.
|
||||
<dependency><!-- until we get this version through Stapler -->
|
||||
<groupId>org.kohsuke.stapler</groupId>
|
||||
<artifactId>json-lib</artifactId>
|
||||
<version>2.1-rev7</version>
|
||||
<version>2.4-jenkins-1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-httpclient</groupId>
|
||||
|
||||
@@ -782,6 +782,7 @@ public class Functions {
|
||||
*
|
||||
* @param predicate
|
||||
* Filter the descriptors based on {@link GlobalConfigurationCategory}
|
||||
* @since 1.494
|
||||
*/
|
||||
public static Collection<Descriptor> getSortedDescriptorsForGlobalConfig(Predicate<GlobalConfigurationCategory> predicate) {
|
||||
ExtensionList<Descriptor> exts = Jenkins.getInstance().getExtensionList(Descriptor.class);
|
||||
@@ -807,13 +808,32 @@ public class Functions {
|
||||
return DescriptorVisibilityFilter.apply(Jenkins.getInstance(),answer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Like {@link #getSortedDescriptorsForGlobalConfig(Predicate)} but with a constant truth predicate, to include all descriptors.
|
||||
*/
|
||||
public static Collection<Descriptor> getSortedDescriptorsForGlobalConfig() {
|
||||
return getSortedDescriptorsForGlobalConfig(Predicates.<GlobalConfigurationCategory>alwaysTrue());
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated This is rather meaningless.
|
||||
*/
|
||||
@Deprecated
|
||||
public static Collection<Descriptor> getSortedDescriptorsForGlobalConfigNoSecurity() {
|
||||
return getSortedDescriptorsForGlobalConfig(Predicates.not(GlobalSecurityConfiguration.FILTER));
|
||||
}
|
||||
|
||||
/**
|
||||
* Like {@link #getSortedDescriptorsForGlobalConfig(Predicate)} but for unclassified descriptors only.
|
||||
* @since 1.506
|
||||
*/
|
||||
public static Collection<Descriptor> getSortedDescriptorsForGlobalConfigUnclassified() {
|
||||
return getSortedDescriptorsForGlobalConfig(new Predicate<GlobalConfigurationCategory>() {
|
||||
public boolean apply(GlobalConfigurationCategory cat) {
|
||||
return cat instanceof GlobalConfigurationCategory.Unclassified;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static class Tag implements Comparable<Tag> {
|
||||
double ordinal;
|
||||
|
||||
@@ -171,7 +171,7 @@ public class FileParameterValue extends ParameterValue {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortDescription() {
|
||||
public String toString() {
|
||||
return "(FileParameterValue) " + getName() + "='" + originalFileName + "'";
|
||||
}
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ public class RunParameterValue extends ParameterValue {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortDescription() {
|
||||
public String toString() {
|
||||
return "(RunParameterValue) " + getName() + "='" + getRunId() + "'";
|
||||
}
|
||||
|
||||
|
||||
@@ -58,6 +58,8 @@ import java.util.Set;
|
||||
import javax.servlet.ServletException;
|
||||
|
||||
import jenkins.model.Jenkins;
|
||||
import jenkins.slaves.WorkspaceLocator;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.kohsuke.stapler.DataBoundConstructor;
|
||||
import org.kohsuke.stapler.HttpResponse;
|
||||
@@ -267,6 +269,13 @@ public abstract class Slave extends Node implements Serializable {
|
||||
}
|
||||
|
||||
public FilePath getWorkspaceFor(TopLevelItem item) {
|
||||
for (WorkspaceLocator l : WorkspaceLocator.all()) {
|
||||
FilePath workspace = l.locate(item, this);
|
||||
if (workspace != null) {
|
||||
return workspace;
|
||||
}
|
||||
}
|
||||
|
||||
FilePath r = getWorkspaceRoot();
|
||||
if(r==null) return null; // offline
|
||||
return r.child(item.getFullName());
|
||||
|
||||
@@ -278,13 +278,15 @@ public class UpdateCenter extends AbstractModelObject implements Saveable, OnMas
|
||||
* Will be the newest of all {@link UpdateSite}s.
|
||||
*/
|
||||
public String getLastUpdatedString() {
|
||||
long newestTs = -1;
|
||||
long newestTs = 0;
|
||||
for (UpdateSite s : sites) {
|
||||
if (s.getDataTimestamp()>newestTs) {
|
||||
newestTs = s.getDataTimestamp();
|
||||
}
|
||||
}
|
||||
if(newestTs<0) return "N/A";
|
||||
if (newestTs == 0) {
|
||||
return Messages.UpdateCenter_n_a();
|
||||
}
|
||||
return Util.getPastTimeString(System.currentTimeMillis()-newestTs);
|
||||
}
|
||||
|
||||
|
||||
@@ -85,18 +85,20 @@ import static hudson.util.TimeUnit2.*;
|
||||
public class UpdateSite {
|
||||
/**
|
||||
* What's the time stamp of data file?
|
||||
* 0 means never.
|
||||
*/
|
||||
private transient long dataTimestamp = -1;
|
||||
private transient volatile long dataTimestamp;
|
||||
|
||||
/**
|
||||
* When was the last time we asked a browser to check the data for us?
|
||||
* 0 means never.
|
||||
*
|
||||
* <p>
|
||||
* There's normally some delay between when we send HTML that includes the check code,
|
||||
* until we get the data back, so this variable is used to avoid asking too many browseres
|
||||
* all at once.
|
||||
*/
|
||||
private transient volatile long lastAttempt = -1;
|
||||
private transient volatile long lastAttempt;
|
||||
|
||||
/**
|
||||
* If the attempt to fetch data fails, we progressively use longer time out before retrying,
|
||||
@@ -129,14 +131,6 @@ public class UpdateSite {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
/**
|
||||
* When read back from XML, initialize them back to -1.
|
||||
*/
|
||||
private Object readResolve() {
|
||||
dataTimestamp = lastAttempt = -1;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get ID string.
|
||||
*/
|
||||
@@ -147,6 +141,7 @@ public class UpdateSite {
|
||||
|
||||
@Exported
|
||||
public long getDataTimestamp() {
|
||||
assert dataTimestamp >= 0;
|
||||
return dataTimestamp;
|
||||
}
|
||||
|
||||
@@ -171,7 +166,11 @@ public class UpdateSite {
|
||||
String uncleanJson = IOUtils.toString(is,"UTF-8");
|
||||
int jsonStart = uncleanJson.indexOf("{\"");
|
||||
if (jsonStart >= 0) {
|
||||
return updateData(uncleanJson.substring(jsonStart), signatureCheck);
|
||||
uncleanJson = uncleanJson.substring(jsonStart);
|
||||
int end = uncleanJson.lastIndexOf('}');
|
||||
if (end>0)
|
||||
uncleanJson = uncleanJson.substring(0,end+1);
|
||||
return updateData(uncleanJson, signatureCheck);
|
||||
} else {
|
||||
throw new IOException("Could not find json in content of " +
|
||||
"update center from url: "+src.toExternalForm());
|
||||
@@ -239,7 +238,7 @@ public class UpdateSite {
|
||||
*/
|
||||
public boolean isDue() {
|
||||
if(neverUpdate) return false;
|
||||
if(dataTimestamp==-1)
|
||||
if(dataTimestamp == 0)
|
||||
dataTimestamp = getDataFile().file.lastModified();
|
||||
long now = System.currentTimeMillis();
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import jenkins.model.Jenkins;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Enumeration;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.servlet.Filter;
|
||||
@@ -76,15 +77,14 @@ public class CrumbFilter implements Filter {
|
||||
if (crumbIssuer.validateCrumb(httpRequest, crumbSalt, crumb)) {
|
||||
valid = true;
|
||||
} else {
|
||||
LOGGER.warning("Found invalid crumb " + crumb +
|
||||
". Will check remaining parameters for a valid one...");
|
||||
LOGGER.log(Level.WARNING, "Found invalid crumb {0}. Will check remaining parameters for a valid one...", crumb);
|
||||
}
|
||||
}
|
||||
// Multipart requests need to be handled by each handler.
|
||||
if (valid || isMultipart(httpRequest)) {
|
||||
chain.doFilter(request, response);
|
||||
} else {
|
||||
LOGGER.warning("No valid crumb was included in request for " + httpRequest.getRequestURI() + ". Returning " + HttpServletResponse.SC_FORBIDDEN + ".");
|
||||
LOGGER.log(Level.WARNING, "No valid crumb was included in request for {0}. Returning {1}.", new Object[] {httpRequest.getRequestURI(), HttpServletResponse.SC_FORBIDDEN});
|
||||
httpResponse.sendError(HttpServletResponse.SC_FORBIDDEN,"No valid crumb was included in the request");
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -94,6 +94,7 @@ import hudson.DNSMultiCast;
|
||||
import hudson.DescriptorExtensionList;
|
||||
import hudson.Extension;
|
||||
import hudson.ExtensionList;
|
||||
import hudson.ExtensionPoint;
|
||||
import hudson.FilePath;
|
||||
import hudson.Functions;
|
||||
import hudson.Launcher;
|
||||
@@ -110,6 +111,7 @@ import hudson.UDPBroadcastThread;
|
||||
import hudson.Util;
|
||||
import static hudson.Util.fixEmpty;
|
||||
import static hudson.Util.fixNull;
|
||||
import hudson.WebAppMain;
|
||||
import hudson.XmlFile;
|
||||
import hudson.cli.CLICommand;
|
||||
import hudson.cli.CliEntryPoint;
|
||||
@@ -195,6 +197,7 @@ import jenkins.InitReactorRunner;
|
||||
import jenkins.model.ProjectNamingStrategy.DefaultProjectNamingStrategy;
|
||||
import jenkins.security.ConfidentialKey;
|
||||
import jenkins.security.ConfidentialStore;
|
||||
import jenkins.slaves.WorkspaceLocator;
|
||||
import jenkins.util.io.FileBoolean;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.acegisecurity.AccessDeniedException;
|
||||
@@ -247,6 +250,7 @@ import javax.servlet.http.Cookie;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import static hudson.init.InitMilestone.*;
|
||||
import hudson.security.BasicAuthenticationFilter;
|
||||
import static javax.servlet.http.HttpServletResponse.SC_BAD_REQUEST;
|
||||
import static javax.servlet.http.HttpServletResponse.SC_NOT_FOUND;
|
||||
import java.io.File;
|
||||
@@ -790,7 +794,7 @@ public class Jenkins extends AbstractCIBase implements ModifiableTopLevelItemGro
|
||||
// JSON binding needs to be able to see all the classes from all the plugins
|
||||
WebApp.get(servletContext).setClassLoader(pluginManager.uberClassLoader);
|
||||
|
||||
adjuncts = new AdjunctManager(servletContext, pluginManager.uberClassLoader,"adjuncts/"+SESSION_HASH);
|
||||
adjuncts = new AdjunctManager(servletContext, pluginManager.uberClassLoader,"adjuncts/"+SESSION_HASH, TimeUnit2.DAYS.toMillis(365));
|
||||
|
||||
// initialization consists of ...
|
||||
executeReactor( is,
|
||||
@@ -1922,6 +1926,13 @@ public class Jenkins extends AbstractCIBase implements ModifiableTopLevelItemGro
|
||||
}
|
||||
|
||||
public FilePath getWorkspaceFor(TopLevelItem item) {
|
||||
for (WorkspaceLocator l : WorkspaceLocator.all()) {
|
||||
FilePath workspace = l.locate(item, this);
|
||||
if (workspace != null) {
|
||||
return workspace;
|
||||
}
|
||||
}
|
||||
|
||||
return new FilePath(expandVariablesForDirectory(workspaceDir, item));
|
||||
}
|
||||
|
||||
@@ -2702,7 +2713,7 @@ public class Jenkins extends AbstractCIBase implements ModifiableTopLevelItemGro
|
||||
jdks.addAll(req.bindJSONToList(JDK.class,json.get("jdks")));
|
||||
|
||||
boolean result = true;
|
||||
for( Descriptor<?> d : Functions.getSortedDescriptorsForGlobalConfig() )
|
||||
for (Descriptor<?> d : Functions.getSortedDescriptorsForGlobalConfigUnclassified())
|
||||
result &= configureDescriptor(req,json,d);
|
||||
|
||||
version = VERSION;
|
||||
@@ -2886,7 +2897,7 @@ public class Jenkins extends AbstractCIBase implements ModifiableTopLevelItemGro
|
||||
* Check if the given name is suitable as a name
|
||||
* for job, view, etc.
|
||||
*
|
||||
* @throws ParseException
|
||||
* @throws Failure
|
||||
* if the given name is not good
|
||||
*/
|
||||
public static void checkGoodName(String name) throws Failure {
|
||||
@@ -2907,7 +2918,7 @@ public class Jenkins extends AbstractCIBase implements ModifiableTopLevelItemGro
|
||||
|
||||
/**
|
||||
* Makes sure that the given name is good as a job name.
|
||||
* @return trimmed name if valid; throws ParseException if not
|
||||
* @return trimmed name if valid; throws Failure if not
|
||||
*/
|
||||
private String checkJobName(String name) throws Failure {
|
||||
checkGoodName(name);
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package jenkins.slaves;
|
||||
|
||||
import hudson.ExtensionList;
|
||||
import hudson.ExtensionPoint;
|
||||
import hudson.FilePath;
|
||||
import hudson.model.Node;
|
||||
import hudson.model.TopLevelItem;
|
||||
import jenkins.model.Jenkins;
|
||||
|
||||
/**
|
||||
* Allow extensions to override workspace locations
|
||||
* on given slaves or projects.
|
||||
*
|
||||
* @author ryan.campbell@gmail.com
|
||||
* @since 1.501
|
||||
*/
|
||||
public abstract class WorkspaceLocator implements ExtensionPoint {
|
||||
|
||||
/**
|
||||
* Allows extensions to customize the workspace path. The first non-null response
|
||||
* will determine the path to the workspace on that slave.
|
||||
*
|
||||
* @param item The toplevel item
|
||||
* @param slave The slave
|
||||
* @return The absolute FilePath to the workspace on the slave.
|
||||
* Will be created if it doesn't exist.
|
||||
*
|
||||
*/
|
||||
public abstract FilePath locate(TopLevelItem item, Node node);
|
||||
|
||||
|
||||
/**
|
||||
* All registered {@link WorkspaceLocator}s.
|
||||
*/
|
||||
public static ExtensionList<WorkspaceLocator> all() {
|
||||
return Jenkins.getInstance().getExtensionList(WorkspaceLocator.class);
|
||||
}
|
||||
}
|
||||
@@ -245,6 +245,7 @@ Slave.UnixSlave=This is a Unix slave
|
||||
Slave.WindowsSlave=This is a Windows slave
|
||||
|
||||
UpdateCenter.DownloadButNotActivated=Downloaded Successfully. Will be activated during the next boot
|
||||
UpdateCenter.n_a=N/A
|
||||
View.Permissions.Title=View
|
||||
View.CreatePermission.Description=\
|
||||
This permission allows users to create new views.
|
||||
|
||||
@@ -53,7 +53,7 @@ THE SOFTWARE.
|
||||
</f:entry>
|
||||
|
||||
<!-- global configuration from everyone -->
|
||||
<j:forEach var="descriptor" items="${h.getSortedDescriptorsForGlobalConfigNoSecurity()}">
|
||||
<j:forEach var="descriptor" items="${h.getSortedDescriptorsForGlobalConfigUnclassified()}">
|
||||
<j:set var="instance" value="${descriptor}" /><!-- this makes the <f:textbox field=.../> work -->
|
||||
<f:rowSet name="${descriptor.jsonSafeClassName}">
|
||||
<st:include page="${descriptor.globalConfigPage}" from="${descriptor}" />
|
||||
|
||||
+5
@@ -35,3 +35,8 @@ rekeySuccessful=\
|
||||
|
||||
rekeyHadProblems=\
|
||||
\u91d1\u9470\u91cd\u5957\u5b8c\u6210\uff0c\u4f46\u662f\u9047\u5230\u4e00\u4e9b\u554f\u984c\u3002<a href="{0}">\u8acb\u67e5\u770b\u8a18\u9304</a>\u3002
|
||||
|
||||
Re-key\ in\ background\ now=\u99ac\u4e0a\u5728\u80cc\u666f\u91cd\u5957\u91d1\u9470
|
||||
Re-keying\ currently\ scheduled\ during\ the\ next\ startup=\u5df2\u7d93\u6392\u5b9a\u5728\u4e0b\u6b21\u555f\u52d5\u5f8c\u91cd\u5957\u91d1\u9470
|
||||
Schedule\ a\ re-key\ during\ the\ next\ startup=\u6392\u7a0b\u5728\u4e0b\u6b21\u555f\u52d5\u5f8c\u91cd\u5957\u91d1\u9470
|
||||
Dismiss\ this\ message=\u5ffd\u7565\u9019\u500b\u8a0a\u606f
|
||||
@@ -34,8 +34,6 @@ Behaviour.specify("DIV.textarea-preview-container", 'textarea', 100, function (e
|
||||
};
|
||||
|
||||
new Ajax.Request(rootURL + showPreview.getAttribute("previewEndpoint"), {
|
||||
method: "POST",
|
||||
requestHeaders: "Content-Type: application/x-www-form-urlencoded",
|
||||
parameters: {
|
||||
text: text
|
||||
},
|
||||
|
||||
@@ -24,35 +24,31 @@
|
||||
package hudson.model;
|
||||
|
||||
import com.trilead.ssh2.crypto.Base64;
|
||||
import hudson.util.FormValidation;
|
||||
import hudson.util.FormValidation.Kind;
|
||||
import hudson.util.TimeUnit2;
|
||||
import junit.framework.TestCase;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.security.cert.CertificateExpiredException;
|
||||
import java.security.cert.CertificateFactory;
|
||||
import java.security.cert.CertificateNotYetValidException;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.util.Date;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assume.*;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Quick test for {@link UpdateCenter}.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
public class UpdateCenterTest extends TestCase {
|
||||
public void testData() throws Exception {
|
||||
// check if we have the internet connectivity. See HUDSON-2095
|
||||
public class UpdateCenterTest {
|
||||
@Test public void data() throws Exception {
|
||||
try {
|
||||
new URL("http://updates.jenkins-ci.org/").openStream();
|
||||
} catch (IOException e) {
|
||||
System.out.println("Skipping this test. No internet connectivity");
|
||||
return;
|
||||
assumeNoException("No internet connectivity", e); // JENKINS-2095
|
||||
}
|
||||
|
||||
URL url = new URL("http://updates.jenkins-ci.org/update-center.json?version=build");
|
||||
|
||||
@@ -25,6 +25,7 @@ package hudson.model
|
||||
|
||||
import org.jvnet.hudson.test.HudsonTestCase
|
||||
import hudson.model.UpdateCenter.DownloadJob.Success
|
||||
import hudson.model.UpdateSite
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -42,4 +43,11 @@ public class UpdateCenter2Test extends HudsonTestCase {
|
||||
println job.status;
|
||||
assertTrue(job.status instanceof Success)
|
||||
}
|
||||
|
||||
void testGetLastUpdatedString() {
|
||||
UpdateSite.neverUpdate = false
|
||||
assertTrue(jenkins.updateCenter.getById("default").due)
|
||||
assertEquals(hudson.model.Messages.UpdateCenter_n_a(), jenkins.updateCenter.lastUpdatedString)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -40,6 +40,7 @@ import hudson.ExtensionPoint;
|
||||
import hudson.model.Describable;
|
||||
import hudson.model.Descriptor;
|
||||
import jenkins.model.Jenkins;
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.jvnet.hudson.test.HudsonTestCase;
|
||||
import org.kohsuke.stapler.DataBoundConstructor;
|
||||
@@ -79,9 +80,9 @@ public class RepeatableTest extends HudsonTestCase {
|
||||
|
||||
public void testSimple() throws Exception {
|
||||
doTestSimple();
|
||||
assertEquals("[{\"bool\":false,\"txt\":\"value one\"},"
|
||||
assertEqualsJsonArray("[{\"bool\":false,\"txt\":\"value one\"},"
|
||||
+ "{\"bool\":false,\"txt\":\"value two\"},{\"bool\":true,\"txt\":\"value three\"}]",
|
||||
formData.get("foos").toString());
|
||||
formData.get("foos"));
|
||||
}
|
||||
|
||||
// ========================================================================
|
||||
@@ -102,10 +103,10 @@ public class RepeatableTest extends HudsonTestCase {
|
||||
public void testSimple_ExistingData() throws Exception {
|
||||
addData();
|
||||
doTestSimple();
|
||||
assertEquals("[{\"bool\":true,\"txt\":\"existing one\"},"
|
||||
assertEqualsJsonArray("[{\"bool\":true,\"txt\":\"existing one\"},"
|
||||
+ "{\"bool\":false,\"txt\":\"existing two\"},{\"bool\":true,\"txt\":\"value one\"},"
|
||||
+ "{\"bool\":false,\"txt\":\"value two\"},{\"bool\":false,\"txt\":\"value three\"}]",
|
||||
formData.get("foos").toString());
|
||||
formData.get("foos"));
|
||||
}
|
||||
|
||||
public void testMinimum() throws Exception {
|
||||
@@ -118,9 +119,9 @@ public class RepeatableTest extends HudsonTestCase {
|
||||
try { f.getInputByValue(""); fail("?"); } catch (ElementNotFoundException expected) { }
|
||||
f.getInputsByName("bool").get(2).click();
|
||||
submit(f);
|
||||
assertEquals("[{\"bool\":false,\"txt\":\"value one\"},"
|
||||
assertEqualsJsonArray("[{\"bool\":false,\"txt\":\"value one\"},"
|
||||
+ "{\"bool\":false,\"txt\":\"value two\"},{\"bool\":true,\"txt\":\"value three\"}]",
|
||||
formData.get("foos").toString());
|
||||
formData.get("foos"));
|
||||
}
|
||||
|
||||
public void testMinimum_ExistingData() throws Exception {
|
||||
@@ -132,9 +133,9 @@ public class RepeatableTest extends HudsonTestCase {
|
||||
try { f.getInputByValue(""); fail("?"); } catch (ElementNotFoundException expected) { }
|
||||
f.getInputsByName("bool").get(1).click();
|
||||
submit(f);
|
||||
assertEquals("[{\"bool\":true,\"txt\":\"existing one\"},"
|
||||
assertEqualsJsonArray("[{\"bool\":true,\"txt\":\"existing one\"},"
|
||||
+ "{\"bool\":true,\"txt\":\"existing two\"},{\"bool\":false,\"txt\":\"new one\"}]",
|
||||
formData.get("foos").toString());
|
||||
formData.get("foos"));
|
||||
}
|
||||
|
||||
public void testNoData() throws Exception {
|
||||
@@ -174,8 +175,8 @@ public class RepeatableTest extends HudsonTestCase {
|
||||
addDefaults();
|
||||
gotoAndSubmitConfig(viewName);
|
||||
assertNotNull(formData.get("list"));
|
||||
assertEquals("[{\"bool\":true,\"txt\":\"default one\"},{\"bool\":false,\"txt\":\"default two\"}]",
|
||||
formData.get("list").toString());
|
||||
assertEqualsJsonArray("[{\"bool\":true,\"txt\":\"default one\"},{\"bool\":false,\"txt\":\"default two\"}]",
|
||||
formData.get("list"));
|
||||
}
|
||||
|
||||
private void assertDefaultsIgnoredIfHaveData(final String viewName) throws Exception {
|
||||
@@ -183,8 +184,8 @@ public class RepeatableTest extends HudsonTestCase {
|
||||
addDefaults();
|
||||
gotoAndSubmitConfig(viewName);
|
||||
assertNotNull(formData.get("list"));
|
||||
assertEquals("[{\"bool\":true,\"txt\":\"existing one\"},{\"bool\":false,\"txt\":\"existing two\"}]",
|
||||
formData.get("list").toString());
|
||||
assertEqualsJsonArray("[{\"bool\":true,\"txt\":\"existing one\"},{\"bool\":false,\"txt\":\"existing two\"}]",
|
||||
formData.get("list"));
|
||||
}
|
||||
|
||||
private void gotoAndSubmitConfig(final String viewName) throws Exception {
|
||||
@@ -207,9 +208,9 @@ public class RepeatableTest extends HudsonTestCase {
|
||||
f.getInputByValue("").setValueAttribute("txt two");
|
||||
f.getElementsByAttribute("INPUT", "type", "radio").get(3).click();
|
||||
submit(f);
|
||||
assertEquals("[{\"radio\":\"two\",\"txt\":\"txt one\"},"
|
||||
+ "{\"radio\":\"two\",\"txt\":\"txt two\"}]",
|
||||
formData.get("foos").toString());
|
||||
assertEqualsJsonArray("[{\"radio\":\"two\",\"txt\":\"txt one\"},"
|
||||
+ "{\"radio\":\"two\",\"txt\":\"txt two\"}]",
|
||||
formData.get("foos"));
|
||||
}
|
||||
|
||||
public static class FooRadio {
|
||||
@@ -227,9 +228,9 @@ public class RepeatableTest extends HudsonTestCase {
|
||||
f.getInputByValue("").setValueAttribute("txt 4");
|
||||
f.getElementsByAttribute("INPUT", "type", "radio").get(7).click();
|
||||
submit(f);
|
||||
assertEquals("[{\"radio\":\"one\",\"txt\":\"1\"},{\"radio\":\"two\",\"txt\":\"2\"},"
|
||||
assertEqualsJsonArray("[{\"radio\":\"one\",\"txt\":\"1\"},{\"radio\":\"two\",\"txt\":\"2\"},"
|
||||
+ "{\"radio\":\"one\",\"txt\":\"three\"},{\"radio\":\"two\",\"txt\":\"txt 4\"}]",
|
||||
formData.get("foos").toString());
|
||||
formData.get("foos"));
|
||||
}
|
||||
|
||||
// hudson-behavior uniquifies radiobutton names so the browser properly handles each group,
|
||||
@@ -247,9 +248,9 @@ public class RepeatableTest extends HudsonTestCase {
|
||||
f.getElementsByAttribute("INPUT", "type", "radio").get(2).click();
|
||||
f.getInputByValue("").setValueAttribute("avalue two");
|
||||
submit(f);
|
||||
assertEquals("[{\"radio\":{\"b\":\"bvalue\",\"value\":\"two\"},\"txt\":\"txt one\"},"
|
||||
assertEqualsJsonArray("[{\"radio\":{\"b\":\"bvalue\",\"value\":\"two\"},\"txt\":\"txt one\"},"
|
||||
+ "{\"radio\":{\"a\":\"avalue two\",\"value\":\"one\"},\"txt\":\"txt two\"}]",
|
||||
formData.get("foos").toString());
|
||||
formData.get("foos"));
|
||||
}
|
||||
|
||||
// ========================================================================
|
||||
@@ -394,9 +395,13 @@ public class RepeatableTest extends HudsonTestCase {
|
||||
throw e;
|
||||
}
|
||||
submit(f);
|
||||
assertEquals("[{\"moo\":{\"inner\":\"inone\"},\"outer\":\"two\"},"
|
||||
+ "{\"moo\":[{\"inner\":\"intwo\"},{\"inner\":\"inone\"}],\"outer\":\"one\"}]",
|
||||
formData.get("items").toString());
|
||||
assertEqualsJsonArray("[{\"moo\":{\"inner\":\"inone\"},\"outer\":\"two\"},"
|
||||
+ "{\"moo\":[{\"inner\":\"intwo\"},{\"inner\":\"inone\"}],\"outer\":\"one\"}]",
|
||||
formData.get("items"));
|
||||
}
|
||||
|
||||
private void assertEqualsJsonArray(String golden, Object jsonArray) {
|
||||
assertEquals(JSONArray.fromObject(golden),jsonArray);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
<div>
|
||||
管理要保留的建置記錄 (包含畫面輸出、建置成品等) 數,控制 Jenkins 的磁碟使用量者。
|
||||
管理要保留的建置記錄 (包含畫面輸出、建置成品等) 數,控制 Jenkins 的磁碟使用量。
|
||||
Jenkins 提供兩種準則:
|
||||
|
||||
<ol>
|
||||
<li>
|
||||
依新舊狀況處理。您可以要 Jenkins 刪除超過指定時間 (例如 7 天) 前的記錄。
|
||||
依新舊狀況處理。您可以要 Jenkins 刪除指定時間 (例如 7 天) 前的記錄。
|
||||
<li>
|
||||
依次數處理。您可以讓 Jenkins 只保留最近的 N 筆建置記錄。如果開始新的建置後,最早的記錄就會被刪掉。
|
||||
</ol>
|
||||
|
||||
Jenkins 也允許您將單獨的建置標為「永久保存這次建置」,將特定幾次重要建置排除在自動刪除清單外。
|
||||
Jenkins 也允許您將某些建置標為「永久保存」,讓特定幾次重要建置不會被自動刪除。
|
||||
最後一次穩定建置及最後一次成功建置也會一直保留住。
|
||||
</div>
|
||||
</div>
|
||||
@@ -9,5 +9,5 @@
|
||||
(不建議) 修改 <code>jenkins.war</code> (或解開到您 Web Container 裡的複本) 裡的 web.xml。
|
||||
</ol>
|
||||
Jenkins 執行時無法修改這個值。
|
||||
這個項目主要是譹您確認您的設定真的有生效。
|
||||
這個項目主要是讓您確認設定正確與否。
|
||||
</div>
|
||||
@@ -3,21 +3,22 @@
|
||||
|
||||
<dl>
|
||||
<dt><b>
|
||||
盡可能使用這個 Slave
|
||||
盡可能使用這個節點
|
||||
</b></dt>
|
||||
<dd>
|
||||
預設值,也是最常用的設定。
|
||||
這個模式下,Jenkins 會不受限制的使用 Slave。一旦有建置作業可以在這個 Slave 上完成,Jenkins 就會用它。
|
||||
這個模式下,Jenkins 會不受拘束的使用 Slave。一旦有建置作業可以在這個 Slave 上完成,Jenkins 就會用它。
|
||||
</dd>
|
||||
|
||||
<dt><b>
|
||||
將機器保留給限定的作業
|
||||
只保留給限定節點的作業
|
||||
</b></dt>
|
||||
<dd>
|
||||
這個模式下,Jenkins 只會在這部機器上建置那些指定要在這裡跑的那些專案。
|
||||
這個模式下,Jenkins 只會在這部機器上建置那些明確指定只能在這裡跑的專案。
|
||||
|
||||
讓 Slave 保留給特定種類的作業。例如讓 Jenkins 持續執行效能測試。
|
||||
您還可以同時將執行程式數設成 1,這樣一次就只執行一項效能測試,這個執行程式也不會被能在別的 Slave 建置的作業擋到。
|
||||
將節點保留給特定種類的作業。
|
||||
例如讓 Jenkins 持續執行效能測試,您還可以同時將執行程式數設成 1,一次只執行一項效能測試。
|
||||
這個執行程式也不會因為要執行能在別的節點建置的作業而塞住。
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
@@ -100,10 +100,12 @@ var crumb = {
|
||||
wrap: function(headers) {
|
||||
if (this.fieldName!=null) {
|
||||
if (headers instanceof Array)
|
||||
// XXX prototype.js only seems to interpret object
|
||||
headers.push(this.fieldName, this.value);
|
||||
else
|
||||
headers[this.fieldName]=this.value;
|
||||
}
|
||||
// XXX return value unused
|
||||
return headers;
|
||||
},
|
||||
|
||||
|
||||
Reference in new issue
Block a user