• Icon: Improvement Improvement
    • Resolution: Duplicate
    • Icon: Minor Minor
    • None
    • Jenkins ver. 2.7.1, Pipeline: Groovy 2.19

      I need to pass all the parameters from current job to subsequent:

      {{ stage('Call job') {
      dir('LIT')

      { build job: 'Assets', parameters: params }

      }
      }}

      But I get an error:
      java.lang.UnsupportedOperationException: must specify $class with an implementation of interface java.util.List

          [JENKINS-41414] Can't pass parameters list to another job

          Rachel M. added a comment -

          Please, class must be specified in parameters list. For example:

          build job: 'test_jobs', parameters: [[$class: 'StringParameterValue', name: 'param1', value: 'test_param'], [$class: 'StringParameterValue', name:'dummy', value: "${index}"]]
          

          I hope be useful.

          Rachel M. added a comment - Please, class must be specified in parameters list. For example: build job: 'test_jobs' , parameters: [[$class: 'StringParameterValue' , name: 'param1' , value: 'test_param' ], [$class: 'StringParameterValue' , name: 'dummy' , value: "${index}" ]] I hope be useful.

          Real Name added a comment - - edited

          rachel thanks
          But it's not convenient to write list one by one. I need just pass ALL variables to another job. How to pass the whole list as it is?

          Real Name added a comment - - edited rachel thanks But it's not convenient to write list one by one. I need just pass ALL variables to another job. How to pass the whole list as it is?

          Jesse Glick added a comment -

          Possible but awkward currently—you can hard-code the parameters in your script, or you can loop over entries in params and construct downstream parameters. Would be nice to have a single syntax to do so automatically for a large number of parameters.

          Jesse Glick added a comment - Possible but awkward currently—you can hard-code the parameters in your script, or you can loop over entries in params and construct downstream parameters. Would be nice to have a single syntax to do so automatically for a large number of parameters.

          Real Name added a comment -

          jglick
          Could you, please, show me a snippet, how to do that?

          Real Name added a comment - jglick Could you, please, show me a snippet, how to do that?

          Jesse Glick added a comment -

          Use the snippet generator in live Jenkins.

          Jesse Glick added a comment - Use the snippet generator in live Jenkins.

          Real Name added a comment -

          jglick
          The only option I see it to run a job and pass all the parameters manually. How to loop over entries in `param`?

          Real Name added a comment - jglick The only option I see it to run a job and pass all the parameters manually. How to loop over entries in `param`?

          Jesse Glick added a comment -

          I do not have time to write up an example now, sorry.

          Jesse Glick added a comment - I do not have time to write up an example now, sorry.

            Unassigned Unassigned
            orkenstein Real Name
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: