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

Sandboxed System Groovy Scripts don't support multiple assignments (with Tuples)

    Details

    • Similar Issues:

      Description

      Use case

      A sandoxed system script doesn't support multiple assignments (with Tuples):

      def (a, b) = [1,2]
      println a
      

      Returns:

      ERROR: Build step failed with exception 
      org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: 
      General error during canonicalization: not supporting tuples yet
      
      • This is working in non sandboxed mode, but not in sandboxed mode.
      • Reproduced on the latest OSS LTS (2.138.3), with Groovy Plugin version 2.0 and Script Security Plugin version 1.49.

      workaround

      Do not use multiple assignments.

      Note

      It is supported in a Pipeline (as of workflow-cps 2.46, JENKINS-45575). It also works in non sandboxed mode.

        Attachments

          Activity

          Hide
          sgdave David Drum added a comment -

          This also occurs when tabbing away from the Execute system Groovy script Build step when, I assume, Jenkins checks the script in a sandbox. It is possible to ignore the error, save the job configuration, and run the script successfully.

          Show
          sgdave David Drum added a comment - This also occurs when tabbing away from the Execute system Groovy script Build step when, I assume, Jenkins checks the script in a sandbox. It is possible to ignore the error, save the job configuration, and run the script successfully.

            People

            • Assignee:
              Unassigned
              Reporter:
              pierrebtz Pierre Beitz
            • Votes:
              3 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated: