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

Can't pass parameters list to another job

    Details

    • Type: Improvement
    • Status: Resolved (View Workflow)
    • Priority: Minor
    • Resolution: Duplicate
    • Labels:
      None
    • Environment:
      Jenkins ver. 2.7.1, Pipeline: Groovy 2.19
    • Similar Issues:

      Description

      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

        Attachments

          Issue Links

            Activity

            Hide
            rachel 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.

            Show
            rachel 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.
            Hide
            orkenstein Ruslan Khamidullin added a comment - - edited

            Rachel M. 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?

            Show
            orkenstein Ruslan Khamidullin added a comment - - edited Rachel M. 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?
            Hide
            jglick 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.

            Show
            jglick 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.
            Hide
            orkenstein Ruslan Khamidullin added a comment -

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

            Show
            orkenstein Ruslan Khamidullin added a comment - Jesse Glick Could you, please, show me a snippet, how to do that?
            Hide
            jglick Jesse Glick added a comment -

            Use the snippet generator in live Jenkins.

            Show
            jglick Jesse Glick added a comment - Use the snippet generator in live Jenkins.
            Hide
            orkenstein Ruslan Khamidullin added a comment -

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

            Show
            orkenstein Ruslan Khamidullin added a comment - Jesse Glick The only option I see it to run a job and pass all the parameters manually. How to loop over entries in `param`?
            Hide
            jglick Jesse Glick added a comment -

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

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

              People

              • Assignee:
                Unassigned
                Reporter:
                orkenstein Ruslan Khamidullin
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: