Skip to content

Commit

Permalink
[JENKINS-71015] Re-Support Job DSL
Browse files Browse the repository at this point in the history
Detail
======
 - After active-choices-plugin 2.6.0, it use `ScriptlerBuilder` instead
   of `scriptlerScriptId` and `parameter`. But `ScriptlerBuilder`
   doesn't have `DataBoundConstructor` annotation, so Job DSL can't
   recognize the scriptler script syntax in `cascadeChoiceParameter`.
 - Before 2.5.7
   - ![image](https://github.com/biouno/uno-choice-plugin/assets/16630665/3ed374fd-5744-4f3c-b567-aa6fedad0450)
   - ```
     scriptlerScript {
       scriptlerScriptId(String value)
       parameters {
         scriptlerScriptParameter {
           name(String value)
         }
       }
     }
     ```
 - After 2.6.0
   - ![image](https://github.com/biouno/uno-choice-plugin/assets/16630665/cec02a53-486f-424b-bebe-c25977c1a46a)
 - After this commit
   - ![image](https://github.com/jenkinsci/scriptler-plugin/assets/16630665/8036bfa7-777d-4a2d-9ae8-d75b470bae47)
   - ```
     scriptlerScript {
       scriptlerBuilder {
         buildersId(String value)
         scriptId(String value)
         propagateParams(boolean value)
         parameters {
           parameter {
             name(String value)
             value(String value)
           }
         }
       }
       isSandboxed(Boolean value)
       scriptlerScriptId(String value)
     }
     ```

Co-authored-by: Michael Tughan <[email protected]>
  • Loading branch information
limejuny and mtughan committed Oct 18, 2023
1 parent 4522acd commit 29792d5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import org.jenkinsci.plugins.scriptler.util.UIHelper;
import org.jenkinsci.plugins.tokenmacro.MacroEvaluationException;
import org.jenkinsci.plugins.tokenmacro.TokenMacro;
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.HttpResponse;
import org.kohsuke.stapler.Stapler;
import org.kohsuke.stapler.StaplerRequest;
Expand Down Expand Up @@ -81,6 +82,7 @@ public ScriptlerBuilder(String builderId, String scriptId, boolean propagatePara
this(builderId, scriptId, propagateParams, Arrays.asList(Objects.requireNonNull(parameters)));
}

@DataBoundConstructor
public ScriptlerBuilder(String builderId, String scriptId, boolean propagateParams, @NonNull List<Parameter> parameters) {
this.builderId = builderId;
this.scriptId = scriptId;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.jenkinsci.plugins.scriptler.config;

import net.sf.json.JSONObject;
import org.kohsuke.stapler.DataBoundConstructor;

import java.io.Serializable;
import java.util.*;
Expand All @@ -25,6 +26,7 @@ public Parameter(JSONObject object) {
value = object.getString(VALUE);
}

@DataBoundConstructor
public Parameter(String name, String value) {
this.name = name;
this.value = value;
Expand Down

0 comments on commit 29792d5

Please sign in to comment.