mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-16 21:42:27 +00:00
Quiet period wasn't taking effect properly when doing parameterized builds.
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@29665 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
1 parent
a52565547c
commit
05cf2ddc68
2 files changed
+22
-18
No files matched your search
@@ -1410,28 +1410,32 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
|
||||
if (!isBuildable())
|
||||
throw HttpResponses.error(SC_INTERNAL_SERVER_ERROR,new IOException(getFullName()+" is not buildable"));
|
||||
|
||||
String delay = req.getParameter("delay");
|
||||
if (delay!=null) {
|
||||
try {
|
||||
// TODO: more unit handling
|
||||
if(delay.endsWith("sec")) delay=delay.substring(0,delay.length()-3);
|
||||
if(delay.endsWith("secs")) delay=delay.substring(0,delay.length()-4);
|
||||
Hudson.getInstance().getQueue().schedule(this, Integer.parseInt(delay),
|
||||
new CauseAction(cause));
|
||||
} catch (NumberFormatException e) {
|
||||
throw new ServletException("Invalid delay parameter value: "+delay);
|
||||
}
|
||||
} else {
|
||||
scheduleBuild(cause);
|
||||
}
|
||||
Hudson.getInstance().getQueue().schedule(this, getDelay(req), new CauseAction(cause));
|
||||
rsp.forwardToPreviousPage(req);
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes the delay by taking the default value and the override in the request parameter into the account.
|
||||
*/
|
||||
public int getDelay(StaplerRequest req) throws ServletException {
|
||||
String delay = req.getParameter("delay");
|
||||
if (delay==null) return getQuietPeriod();
|
||||
|
||||
try {
|
||||
// TODO: more unit handling
|
||||
if(delay.endsWith("sec")) delay=delay.substring(0,delay.length()-3);
|
||||
if(delay.endsWith("secs")) delay=delay.substring(0,delay.length()-4);
|
||||
return Integer.parseInt(delay);
|
||||
} catch (NumberFormatException e) {
|
||||
throw new ServletException("Invalid delay parameter value: "+delay);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Supports build trigger with parameters via an HTTP GET or POST.
|
||||
* Currently only String parameters are supported.
|
||||
*/
|
||||
public void doBuildWithParameters(StaplerRequest req, StaplerResponse rsp) throws IOException {
|
||||
public void doBuildWithParameters(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
|
||||
BuildAuthorizationToken.checkPermission(this, authToken, req, rsp);
|
||||
|
||||
ParametersDefinitionProperty pp = getProperty(ParametersDefinitionProperty.class);
|
||||
|
||||
@@ -132,8 +132,8 @@ public class ParametersDefinitionProperty extends JobProperty<AbstractProject<?,
|
||||
// send the user back to the job top page.
|
||||
rsp.sendRedirect(".");
|
||||
}
|
||||
|
||||
public void buildWithParameters(StaplerRequest req, StaplerResponse rsp) throws IOException {
|
||||
|
||||
public void buildWithParameters(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
|
||||
List<ParameterValue> values = new ArrayList<ParameterValue>();
|
||||
for (ParameterDefinition d: parameterDefinitions) {
|
||||
ParameterValue value = d.createValue(req);
|
||||
@@ -145,7 +145,7 @@ public class ParametersDefinitionProperty extends JobProperty<AbstractProject<?,
|
||||
}
|
||||
|
||||
Hudson.getInstance().getQueue().schedule(
|
||||
owner, 0, new ParametersAction(values), new CauseAction(new Cause.UserCause()));
|
||||
owner, owner.getDelay(req), new ParametersAction(values), new CauseAction(new Cause.UserCause()));
|
||||
|
||||
// send the user back to the job top page.
|
||||
rsp.sendRedirect(".");
|
||||
|
||||
Reference in new issue
Block a user