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

Input "ChoiceParameterDefinition" with same name make the UI bug (select wrong choice when clicked)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • blueocean-plugin
    • None
    • Jenkins 2.170
      BlueOcean 1.14

      I'm using BlueOcean with declarative Pipelines. In one of my pipeline there is a step which executes a Jenkins "script" in which there is a jenkins "input" using parameter type "ChoiceParameterDefinition". It reads the choices from a variable which contains multiple lines : 

       

      steps {
         script {
         def userInput = input(
            id: 'userInput', message: "mytest",
                parameters: [ 
                [$class: 'ChoiceParameterDefinition', choices: "${VAR_1}", name: 'config']
                ])
      VAR_2 = "${userInput}"           
           }
      } 

       

      When there are choices composed of the exact same string, the UI bugs. The user is prompted with a choice list but when he clicks on the first choice it selects the second one and vice versa. 

      I came accross this bug when I was doing some testings with the same string in each line of the variable. I'm not sure there is a real use case where you would like to have the choice between the "same" options but it should be easy to fix with at least an error saying that you can't have two choices which are the same for 'ChoiceParameterDefinition'.
      Please find an attached screenshot where I clicked the first choice and it selected the second one.

            Unassigned Unassigned
            larkoie Larkoie
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: