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

Snippet editor: Invalid code for "choice" parameter/properties

    XMLWordPrintable

Details

    Description

      Given I use Snippet Editor to generate code for the properties step and
      I select This project is parameterized and
      I add a new Choice Parameter
      When I enter the choices into the text area separated by line breaks and hit the Generate Pipeline Script button
      Then the emitted code includes choices: ['A', 'B', 'C'], which, however, is invalid.

      The resulting error message is:

      java.lang.ClassCastException: hudson.model.ChoiceParameterDefinition.choices expects class java.lang.String but received class java.util.ArrayList

      Instead, the valid code would be choices: ['A\nB\nC'].

      Attachments

        Issue Links

          Activity

            stephenking Steffen Gebert created issue -
            stephenking Steffen Gebert made changes -
            Field Original Value New Value
            Epic Link JENKINS-35393 [ 171186 ]
            stephenking Steffen Gebert made changes -
            Description Given I use Snippet Editor to generate code for the {{properties}} step and
            I select _This project is parameterized_ and
            I add a new _Choice Parameter'
            When I enter the choices into the text area separated by line breaks and hit the _Generate Pipeline Script_ button
            Then the emitted code includes {{choices: ['A', 'B', 'C']}}, which, however, is invalid.

            The resulting error message is:
            {quote}
            java.lang.ClassCastException: hudson.model.ChoiceParameterDefinition.choices expects class java.lang.String but received class java.util.ArrayList
            {quote}

            Instead, the valid code would be {{choices: ['A\nB\nC']}}.
            Given I use Snippet Editor to generate code for the {{properties}} step and
            I select _This project is parameterized_ and
            I add a new _Choice Parameter_
            When I enter the choices into the text area separated by line breaks and hit the _Generate Pipeline Script_ button
            Then the emitted code includes {{choices: ['A', 'B', 'C']}}, which, however, is invalid.

            The resulting error message is:
            {quote}
            java.lang.ClassCastException: hudson.model.ChoiceParameterDefinition.choices expects class java.lang.String but received class java.util.ArrayList
            {quote}

            Instead, the valid code would be {{choices: ['A\nB\nC']}}.
            bitwiseman Liam Newman made changes -
            Link This issue relates to JENKINS-41180 [ JENKINS-41180 ]
            bitwiseman Liam Newman made changes -
            Link This issue relates to JENKINS-26143 [ JENKINS-26143 ]
            abayer Andrew Bayer made changes -
            Component/s workflow-cps-plugin [ 21713 ]
            Component/s pipeline [ 21692 ]
            rodrigc Craig Rodrigues made changes -
            Assignee Daniel Beck [ danielbeck ]
            rodrigc Craig Rodrigues made changes -
            Link This issue duplicates JENKINS-41180 [ JENKINS-41180 ]
            rodrigc Craig Rodrigues made changes -
            Resolution Fixed [ 1 ]
            Status Open [ 1 ] Resolved [ 5 ]

            People

              danielbeck Daniel Beck
              stephenking Steffen Gebert
              Votes:
              5 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: