Skip to content

Commit

Permalink
[JENKINS-24782] Prevent phantom builds from being scheduled when Prom…
Browse files Browse the repository at this point in the history
…otionProcesses are built directly.

There is quite a bit more work to be done to tidy up the UX for PromotionProcesses, but at least we can prevent people from shooting themselves in the foot.
  • Loading branch information
recampbell committed Feb 19, 2015
1 parent 524772c commit dc858e8
Showing 1 changed file with 9 additions and 0 deletions.
Expand Up @@ -38,10 +38,14 @@
import hudson.util.DescribableList;
import hudson.util.FormValidation;
import jenkins.model.Jenkins;
import jenkins.util.TimeDuration;
import net.sf.json.JSONObject;
import org.kohsuke.stapler.HttpResponses;
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;

import javax.servlet.ServletException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
Expand Down Expand Up @@ -404,6 +408,11 @@ public Future<Promotion> scheduleBuild2(AbstractBuild<?,?> build, Cause cause, L
}


@Override
public void doBuild(StaplerRequest req, StaplerResponse rsp, @QueryParameter TimeDuration delay) throws IOException, ServletException {
throw HttpResponses.error(404, "Promotion processes may not be build directly");
}

public Future<Promotion> scheduleBuild2(AbstractBuild<?,?> build, Cause cause) {
return scheduleBuild2(build, cause, null);
}
Expand Down

0 comments on commit dc858e8

Please sign in to comment.