Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-71015

Upgrading to version 2.6.4 from 2.5.7 does not work provided DSL script

      Good morning 

      I have a dsl job creation job that includes active choice parameters and when I migrate the plugin to version 2.6.X I get the following error:

        

      Processing provided DSL script
      ERROR: (unknown source) No signature of method: javaposse.jobdsl.plugin.structs.DescribableContext.parameters() is applicable for argument types: (script$_run_closure2$_closure31$_closure33$_closure41$_closure44$_closure45$_closure46) values: [script$_run_closure2$_closure31$_closure33$_closure41$_closure44$_closure45$_closure46@63cdeea6]

      code:

       

      cascadeChoiceParameter {
         choiceType('PT_SINGLE_SELECT')
          name ("entrega")
          filterable(false)
          filterLength(1)
        referencedParameters('proyecto')
         description("Seleccione la versión de subversion que quiere comprobar")
          randomName("choice-parameter-entrega_1")
          script {
            scriptlerScript(){
             scriptlerScriptId ("entregas.groovy")
             parameters {
                  scriptlerScriptParameter {
                      name("proyecto")
                      value("\$" + "{proyecto}")
                  }
                scriptlerScriptParameter {
                      name("entrega")
                      value("")
                  }
                 scriptlerScriptParameter {
                      name("modulo_tecnico")
                      value("")
                  }
              }
            }
          }
        }
      

       

      greetings and thanks

          [JENKINS-71015] Upgrading to version 2.6.4 from 2.5.7 does not work provided DSL script

          Ismael created issue -
          Ismael made changes -
          Description Original: Good morning 

          I have a dsl job creation job that includes active choice parameters and when I migrate the plugin to version 2.6.X I get the following error:

            
          Processing provided DSL script
          ERROR: (unknown source) No signature of method: javaposse.jobdsl.plugin.structs.DescribableContext.parameters() is applicable for argument types: (script$_run_closure2$_closure31$_closure33$_closure41$_closure44$_closure45$_closure46) values: [script$_run_closure2$_closure31$_closure33$_closure41$_closure44$_closure45$_closure46@63cdeea6]
          code:

           
          {code:java}
          cascadeChoiceParameter {
             choiceType('PT_SINGLE_SELECT')
              name ("entrega")
              filterable(false)
              filterLength(1)
            referencedParameters('proyecto')
             description("Seleccione la versión de subversion que quiere comprobar")
              randomName("choice-parameter-entrega_1")
              script {
                scriptlerScript(){
                 scriptlerScriptId ("entregas.groovy")
                 parameters {
                      scriptlerScriptParameter {
                          name("proyecto")
                          value("\$" + "{proyecto}")
                      }
                    scriptlerScriptParameter {
                          name("entrega")
                          value("")
                      }
                     scriptlerScriptParameter {
                          name("modulo_tecnico")
                          value("")
                      }
                  }
                }
              }
            }
          {code}
           

          greetings and thanks
          New: Good morning 

          I have a dsl job creation job that includes active choice parameters and when I migrate the plugin to version 2.6.X I get the following error:

            
          {code:java}
          Processing provided DSL script
          ERROR: (unknown source) No signature of method: javaposse.jobdsl.plugin.structs.DescribableContext.parameters() is applicable for argument types: (script$_run_closure2$_closure31$_closure33$_closure41$_closure44$_closure45$_closure46) values: [script$_run_closure2$_closure31$_closure33$_closure41$_closure44$_closure45$_closure46@63cdeea6]{code}

          code:

           
          {code:java}
          cascadeChoiceParameter {
             choiceType('PT_SINGLE_SELECT')
              name ("entrega")
              filterable(false)
              filterLength(1)
            referencedParameters('proyecto')
             description("Seleccione la versión de subversion que quiere comprobar")
              randomName("choice-parameter-entrega_1")
              script {
                scriptlerScript(){
                 scriptlerScriptId ("entregas.groovy")
                 parameters {
                      scriptlerScriptParameter {
                          name("proyecto")
                          value("\$" + "{proyecto}")
                      }
                    scriptlerScriptParameter {
                          name("entrega")
                          value("")
                      }
                     scriptlerScriptParameter {
                          name("modulo_tecnico")
                          value("")
                      }
                  }
                }
              }
            }
          {code}
           

          greetings and thanks

          Hi there,
          I created this pull request on scriptler plugin in order to fix the issue.

          https://github.com/jenkinsci/scriptler-plugin/pull/80

          Junyeong Yim (임준영) added a comment - Hi there, I created this pull request on scriptler plugin in order to fix the issue. https://github.com/jenkinsci/scriptler-plugin/pull/80

          Hi juny 

          I am a bit confused here, you create the issue against active-choices, but the PR to fix it in scriptler-plugin. I think the plug-in would have to match in Jira & GH?

          Bruno P. Kinoshita added a comment - Hi juny   I am a bit confused here, you create the issue against active-choices, but the PR to fix it in scriptler-plugin. I think the plug-in would have to match in Jira & GH?
          Junyeong Yim (임준영) made changes -
          Attachment New: image-2023-10-03-13-41-20-793.png [ 61245 ]

          Hi, kinow 

          I had the same issue, and i was confused to analyze, too.

          This is the reason.


          After 2.6.0 of active-choices plugins, it use ScriptlerBuilder (in scriptler-plugin dependency).
            -> active-choices@fddcd3d

          Before 2.5.7, ScriptlerScript (in active-choices) constructor's parameter is "String, List of ScriptlerScriptParameter (in active-choices, and it has @DataBoundConstructor annotation), Boolean", and so Job DSL can use ScriptlerScript in CascadeChoiceParameter.

          So, I had two options

          1. Revert the commit (active-choices@fddcd3d, use ScriptlerBuilder), and receive scriptId, params, etc as constructor's parameters.
          2. Fix ScriptlerBuilder (in scriptler-plugin) to be available in Job DSL (by add @DataBoundConstructor annotation), and after new fixed version of scriptler plugin, update the scriptler plugin's dependency in active-choices plugin.

          I choose second option, because I don't know that commit's context, and ScriptlerBuilder has more parameter (like propagateParams).


          To fix this issue, (as I wrote it before,) scriptler plugin should be updated, and use version dependency in active-choices.
          I tested with local-build version of those two plugins, and it works!

          Junyeong Yim (임준영) added a comment - Hi, kinow   I had the same issue, and i was confused to analyze, too. This is the reason. After 2.6.0 of active-choices  plugins, it use ScriptlerBuilder  (in scriptler-plugin dependency).   -> active-choices@fddcd3d Before 2.5.7, ScriptlerScript  (in active-choices ) constructor's parameter is "String, List of ScriptlerScriptParameter (in active-choices , and it has @DataBoundConstructor annotation), Boolean", and so Job DSL can use ScriptlerScript  in CascadeChoiceParameter. So, I had two options Revert the commit ( active-choices@fddcd3d , use ScriptlerBuilder ), and receive scriptId, params, etc as constructor's parameters. Fix ScriptlerBuilder (in scriptler-plugin ) to be available in Job DSL (by add @DataBoundConstructor annotation), and after new fixed version of scriptler plugin, update the scriptler plugin's dependency in active-choices plugin. I choose second option, because I don't know that commit's context, and ScriptlerBuilder has more parameter (like propagateParams). To fix this issue, (as I wrote it before,) scriptler plugin should be updated, and use version dependency in active-choices. I tested with local-build version of those two plugins, and it works!

          P.S.

          It can help to Job DSL's active-choices to use scriptler script. But there is another bug.
          When create job with Job DSL, the scriptler script's parameter can't created.

          This is the PR to fix that issue. (-> active-choices-plugin#134 )

          Junyeong Yim (임준영) added a comment - P.S. It can help to Job DSL 's active-choices to use scriptler script. But there is another bug. When create job with Job DSL, the scriptler script's parameter can't created. This is the PR to fix that issue. (-> active-choices-plugin#134 )

            kinow Bruno P. Kinoshita
            icv6373 Ismael
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: