Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[FIXED JENKINS-13631] Can't manualy promote maven build since promote…
…d-builds-2.5
  • Loading branch information
ohtake committed Jul 5, 2012
1 parent 9c217ae commit 911595b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
Expand Up @@ -140,19 +140,11 @@ private boolean isInGroupList() {
/**
* Web method to handle the approval action submitted by the user.
*/
public void doApprove(StaplerRequest req, StaplerResponse rsp, @QueryParameter("job") String jobName,
@QueryParameter("buildNumber") int buildNumber, @QueryParameter("promotion") String promotionName,
@AncestorInPath ItemGroup context) throws IOException, ServletException {
public void doApprove(StaplerRequest req, StaplerResponse rsp,
@AncestorInPath PromotionProcess promotionProcess,
@AncestorInPath AbstractBuild<?,?> build) throws IOException, ServletException {

JSONObject formData = req.getSubmittedForm();
AbstractProject<?,?> job = Hudson.getInstance().getItem(jobName, context, AbstractProject.class);

// Get the specific build from the job by number
AbstractBuild<?,?> build = job.getBuildByNumber(buildNumber);

PromotedBuildAction pba = build.getAction(PromotedBuildAction.class);

PromotionProcess promotionProcess = pba.getPromotionProcess(promotionName);

if (canApprove(promotionProcess, build)) {
List<ParameterValue> paramValues = new ArrayList<ParameterValue>();
Expand All @@ -175,7 +167,7 @@ public void doApprove(StaplerRequest req, StaplerResponse rsp, @QueryParameter("
}

// add approval to build
build.addAction(new ManualApproval(promotionName, paramValues));
build.addAction(new ManualApproval(promotionProcess.getName(), paramValues));
build.save();

// check for promotion
Expand Down
@@ -1,6 +1,6 @@
<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">
<l:pane title="${%Manual Approval}" width="100"><tr><td>
<f:form method="post" action="promotionProcess/${h.encode(p.name)}/promotionCondition/hudson.plugins.promoted_builds.conditions.ManualCondition/approve?job=${h.encode(pba.owner.parent.name)}&amp;buildNumber=${pba.owner.number}&amp;promotion=${h.encode(p.name)}" name="approve">
<f:form method="post" action="promotionProcess/${h.encode(p.name)}/promotionCondition/hudson.plugins.promoted_builds.conditions.ManualCondition/approve" name="approve">
<j:if test="${!it.usersAsSet.isEmpty()}">
<f:entry title="${%Approvers}" description="${%List of users or groups that can approve this promotion}">
<f:textbox value="${it.users}" readonly="true"/>
Expand Down

0 comments on commit 911595b

Please sign in to comment.