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

Workflow plugin silently breaks regular Groovy maps

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Duplicate
    • Component/s: pipeline
    • Labels:
    • Environment:
      Jenkins 1.598
      Workflow 1.2
    • Similar Issues:

      Description

      The docs mention the need for all data in steps to be serializable, but it doesn't mention that it somehow breaks Groovy maps in order to do.

      If I run

      def map =  [foo: "bar", test: 'hello']
      
      println 'Using Groovy version ' + GroovySystem.getVersion()
      println map
      
      map.each { k, v -> println "$k := $v" }
      

      I will see the following when I run groovy locally:

      Using Groovy version 1.8.9
      [foo:bar, test:hello]
      foo := bar
      test := hello
      

      However, I'll get this output from the Jenkins workflow plugin: (note that the each() iteration only shows the first element, and it is not a key/value pair

      Using Groovy version 1.8.9
      Running: Print Message
      {foo=bar, test=hello}
      Running: Print Message
      foo=bar := null
      

      If this is expected behavior, it means users cannot use maps as expected, unless specifically passed to workflow classes that know how to read those parameters.

      Am I doing something wrong here, or should the docs just be updated to reflect this?

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jglick Jesse Glick
                Reporter:
                jamesvl James VL
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: