提交 37e9b61a 编写于 作者: M mindless

[FIXED HUDSON-7004] Make /buildWithParameters support remote cause and

user supplied cause text for build via authentication token, just as /build does.


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@33032 71c3de6d-444a-0410-be80-ed276b4c234a
上级 89c437c8
......@@ -1393,6 +1393,17 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
return;
}
if (!isBuildable())
throw HttpResponses.error(SC_INTERNAL_SERVER_ERROR,new IOException(getFullName()+" is not buildable"));
Hudson.getInstance().getQueue().schedule(this, getDelay(req), getBuildCause(req));
rsp.forwardToPreviousPage(req);
}
/**
* Computes the build cause, using RemoteCause or UserCause as appropriate.
*/
/*package*/ CauseAction getBuildCause(StaplerRequest req) {
Cause cause;
if (authToken != null && authToken.getToken() != null && req.getParameter("token") != null) {
// Optional additional cause text when starting via token
......@@ -1401,12 +1412,7 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
} else {
cause = new UserCause();
}
if (!isBuildable())
throw HttpResponses.error(SC_INTERNAL_SERVER_ERROR,new IOException(getFullName()+" is not buildable"));
Hudson.getInstance().getQueue().schedule(this, getDelay(req), new CauseAction(cause));
rsp.forwardToPreviousPage(req);
return new CauseAction(cause);
}
/**
......
/*
* The MIT License
*
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Jean-Baptiste Quenot, Seiji Sogabe, Tom Huybrechts
* Copyright (c) 2004-2010, Sun Microsystems, Inc., Kohsuke Kawaguchi,
* Jean-Baptiste Quenot, Seiji Sogabe, Tom Huybrechts
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
......@@ -145,7 +146,7 @@ public class ParametersDefinitionProperty extends JobProperty<AbstractProject<?,
}
Hudson.getInstance().getQueue().schedule(
owner, owner.getDelay(req), new ParametersAction(values), new CauseAction(new Cause.UserCause()));
owner, owner.getDelay(req), new ParametersAction(values), owner.getBuildCause(req));
// send the user back to the job top page.
rsp.sendRedirect(".");
......
<!--
The MIT License
Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Eric Lefevre-Ardant, Seiji Sogabe
Copyright (c) 2004-2010, Sun Microsystems, Inc., Kohsuke Kawaguchi,
Eric Lefevre-Ardant, Seiji Sogabe
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
......@@ -36,7 +37,10 @@ THE SOFTWARE.
<f:textbox name="authToken" value="${it.authToken.token}" />
${%Use the following URL to trigger build remotely:}
<tt>HUDSON_URL</tt>/${it.url}build?token=<tt>TOKEN_NAME</tt>
<br>${%Optionally append &lt;tt>&amp;cause=Cause+Text&lt;/tt> to provide text that will be included in the recorded build cause.}</br>
${%or}
/buildWithParameters?token=<tt>TOKEN_NAME</tt>
<br/>
${%Optionally append &lt;tt>&amp;cause=Cause+Text&lt;/tt> to provide text that will be included in the recorded build cause.}
</f:entry>
</f:optionalBlock>
</j:if>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册