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

Groovy-backed cascade selects lose sorting/option order after 2.5 upgrade

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • active-choices-plugin
    • None
    • Jenkins 2.249.2 LTS using official Docker image; uno-choice 2.5

      We have quite a few jobs that use CascadeChoiceParameter PT_SINGLE_SELECT, getting their values from a GroovyScript secureScript running in the sandbox. The Groovy script returns a Map of strings.

      We've been using the same code for many years (since at least version 1.3 in July 2017; we didn't track our plugin versions before then), and relying on the fact that choices (options in the HTML) are displayed in the order that they're added to the Map. Essentially, we loop over some objects in sorted order and add them to the Map, where neither the map key nor the map value is the sort key.

      From uno-choice 1.3 until 2.4, options were displayed in the selects in the order they're added to the map. We upgraded to uno-choice 2.5 yesterday, and now the options seem to be displaying in what looks like random order. This has completely broken our use case, as we have select parameters with hundreds of items that are only useful to humans when the options are properly sorted.

      Example use case:
      We have an array of objects, where each object has properties "Name", "Id", and "Date". We loop over the objects sorted by Date, and add them to a map with Id as the key and Name as the value. Up to and including 2.4, this resulted in a select with options that displayed Name, had "Id" as their value, but were sorted by Date.

            kinow Bruno P. Kinoshita
            jantman Jason Antman
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: