Skip to content

Commit

Permalink
Make WorkflowJob.submit honor overrides of FlowDefinitionDescriptor.n…
Browse files Browse the repository at this point in the history
…ewInstance
  • Loading branch information
yaroslavafenkin authored and dwnusbaum committed May 4, 2022
1 parent 04c4e75 commit a25d155
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,11 @@ public void setDefinition(FlowDefinition definition) {
@Override protected void submit(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException, Descriptor.FormException {
super.submit(req, rsp);
JSONObject json = req.getSubmittedForm();
definition = req.bindJSON(FlowDefinition.class, json.getJSONObject("definition"));
// TODO: Switch from Descriptor.newInstancesFromHeteroList to Descriptor.bindJSON when minimum supported
// version is Jenkins 2.342 or higher.
definition = json.get("definition") == null ? null :
Descriptor.newInstancesFromHeteroList(req, json.getJSONObject("definition"),
ExtensionList.lookup(FlowDefinitionDescriptor.class)).get(0);
authToken = hudson.model.BuildAuthorizationToken.create(req);

if (req.getParameter("hasCustomQuietPeriod") != null) {
Expand Down

0 comments on commit a25d155

Please sign in to comment.