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

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

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • workflow-cps-plugin
    • None
    • pipeline:2.4

      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'].

          [JENKINS-40358] Snippet editor: Invalid code for "choice" parameter/properties

          Steffen Gebert created issue -
          Steffen Gebert made changes -
          Epic Link New: JENKINS-35393 [ 171186 ]
          Steffen Gebert made changes -
          Description Original: 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']}}.
          New: 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']}}.
          Liam Newman made changes -
          Link New: This issue relates to JENKINS-41180 [ JENKINS-41180 ]
          Liam Newman made changes -
          Link New: This issue relates to JENKINS-26143 [ JENKINS-26143 ]
          Andrew Bayer made changes -
          Component/s New: workflow-cps-plugin [ 21713 ]
          Component/s Original: pipeline [ 21692 ]
          Craig Rodrigues made changes -
          Assignee New: Daniel Beck [ danielbeck ]
          Craig Rodrigues made changes -
          Link New: This issue duplicates JENKINS-41180 [ JENKINS-41180 ]
          Craig Rodrigues made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]

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

              Created:
              Updated:
              Resolved: