Skip to content

Commit

Permalink
Merge pull request #2262 from kuisathaverat/JENKINS-34146
Browse files Browse the repository at this point in the history
[FIX JENKINS-34146] check if build is build able before to ask for parameters
  • Loading branch information
daniel-beck committed Apr 22, 2016
2 parents ce9de5a + 37e7856 commit f6e431b
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 f6e431b

Please sign in to comment.