Skip to content

Commit

Permalink
[JENKINS-34146] check if build is build able before to ask for parame…
Browse files Browse the repository at this point in the history
…ters
  • Loading branch information
kuisathaverat committed Apr 13, 2016
1 parent ca1cc0e commit 37e7856
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions core/src/main/java/jenkins/model/ParameterizedJobMixIn.java
Expand Up @@ -177,6 +177,10 @@ public final void doBuild(StaplerRequest req, StaplerResponse rsp, @QueryParamet
delay = new TimeDuration(asJob().getQuietPeriod());
}

if (!asJob().isBuildable()) {
throw HttpResponses.error(SC_INTERNAL_SERVER_ERROR, new IOException(asJob().getFullName() + " is not buildable"));
}

// if a build is parameterized, let that take over
ParametersDefinitionProperty pp = asJob().getProperty(ParametersDefinitionProperty.class);
if (pp != null && !req.getMethod().equals("POST")) {
Expand All @@ -192,9 +196,6 @@ public final void doBuild(StaplerRequest req, StaplerResponse rsp, @QueryParamet
return;
}

if (!asJob().isBuildable()) {
throw HttpResponses.error(SC_INTERNAL_SERVER_ERROR, new IOException(asJob().getFullName() + " is not buildable"));
}

Queue.Item item = Jenkins.getInstance().getQueue().schedule2(asJob(), delay.getTime(), getBuildCause(asJob(), req)).getItem();
if (item != null) {
Expand Down

0 comments on commit 37e7856

Please sign in to comment.