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

Active choice parameter filter throws JavaScript error for parameter change event in browser console

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • active-choices-plugin
    • None
    • Jenkins 2.462.3
      Active Choices Plugin 2.8.4
      JDK 17
      Chrome/Edge browsers

      Use Case:

      • Pipeline
      • Active choice single select with filter parameter - paramA
      • Active reactive choice parameter - paramB that dispays options based on paramA
      • Filter paramA

       

      Expected results:

      Typing in filter of paramA, expect paramB to update its options based on the selected value in paramA dropdown.

       

      Actual results:

      paramB not updated (see attachments) and browser dev tools shows JS error (see attachments).

       

      Additional notes:

      • Manually selecting a new option in paramA dropdown works just fine.
      • Filtering down to one option does not allow manual selection since it is already selected.

       

      Test pipeline:

      #!groovy
      
      properties([
          parameters([
              [
                  $class: 'ChoiceParameter',
                  choiceType: 'PT_SINGLE_SELECT',
                  description: 'Choose opion',
                  filterLength: 1,
                  filterable: true,
                  name: 'paramA',
                  script: [
                      $class: 'GroovyScript',
                      script: [
                          classpath: [],
                          sandbox: true,
                          script: 'return ["AAA","BBB","CCC"]'
                      ],
                      fallbackScript: [
                          classpath: [],
                          sandbox: true,
                          script: 'return["ERROR paramA"]'
                      ]
                  ]
              ],
              [
                  $class: 'CascadeChoiceParameter',
                  choiceType: 'PT_RADIO',
                  description: 'chose related option',
                  filterLength: 1,
                  filterable: false,
                  name: 'paramB',
                  referencedParameters: 'paramA',
                  script: [
                      $class: 'GroovyScript',
                      script: [
                          classpath: [],
                          sandbox: true,
                          script: '''
                              if (paramA.equals("AAA")) {
                                  return ["AAA-1","AAA-2","AAA-3"]
                              }
                              else if (paramA.equals("BBB")) {
                                  return ["BBB-1","BBB-2","BBB-3"]
                              }
                              else if (paramA.equals("CCC")) {
                                  return ["CCC-1","CCC-2","CCC-3"]
                              }
                              else {
                                  return ["UNK"]
                              }
                          '''
                      ],
                      fallbackScript: [
                          classpath: [],
                          sandbox: true,
                          script: 'return["ERROR paramB"]'
                      ]
                  ]
              ]
          ])
      ])
      
      pipeline {
          agent any
      
          stages {
              stage('Params') {
                  steps {
                      echo "paramA: ${params.paramA}"
                      echo "paramB: ${params.paramB}"
                  }
              }
          }
      }
      

            kinow Bruno P. Kinoshita
            chamacs D. Saville
            Votes:
            5 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated: