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

Support ExtendedChoiceParameterDefinition plugin

XMLWordPrintable

      I have a pipeline step which has the following code for a input step :

      dynamicInput = input id: 'dynamicInput', message: 'Fill the form & wait for approval from EP', ok: 'Request', parameters: [
                       [$class: 'ChoiceParameterDefinition', choices: 'centos6\ncentos7\nrhel6\nrhel7', description: 'Select the os your job targets', name: 'OS'],
                       [$class: 'ChoiceParameterDefinition', choices: 'x86_64\ni386\nnoarch', description: 'Select the architecture your job targets', name: 'Arch'],
                       [$class: 'ChoiceParameterDefinition', choices: 'java\nnodejs', description: 'Select the type of singlebuild job', name: 'JobType'],
                       [$class: 'StringParameterDefinition', defaultValue: "sample_name", description: 'Enter the app name(lower snake_case only - https://en.wikipedia.org/wiki/Snake_case)', name: 'AppName'],
                       [$class: 'StringParameterDefinition', defaultValue: "", description: 'Enter the list of files you want to package as part of artifact', name: 'FileList'],
                       [$class: 'StringParameterDefinition', defaultValue: "", description: 'Enter the Directory name for artifacts', name: 'DirName'],
                       [$class: 'StringParameterDefinition', defaultValue: "https://github.net/organization/reponame.git", description: 'Https Git url for your repository', name: 'GitUrl'],
                       taxonomy,
                       [$class: 'StringParameterDefinition', defaultValue: "", description: 'Enter team slack channel name for notifications', name: 'SlackChannel'],
                       [$class: 'StringParameterDefinition', defaultValue: "", description: 'Enter team slack channel token for notifications', name: 'SlackToken'],
      submitterParameter: "submittedby"
                       echo ("input is : " + dynamicInput)
      

      The taxonomy here is a global groovy function from the workflow library (https://github.com/jenkinsci/workflow-cps-global-lib-plugin). The code behind the taxonomy keyword sits in jenkins and is basically this:

      import com.cwctravel.hudson.plugins.extended_choice_parameter.ExtendedChoiceParameterDefinition
      
      def call(body) {
        node ('xxx') {
          def taxonomy = new ExtendedChoiceParameterDefinition("Taxonomy",
                                                                ExtendedChoiceParameterDefinition.PARAMETER_TYPE_SINGLE_SELECT,
                                                                null,
                                                                null,
                                                                null,
                                                                null,
                                                                env.JENKINS_HOME+"/workflow-libs/src/ep/taxonomylist.groovy",
                                                                null,
                                                                null,
                                                                null,
                                                                null,
                                                                null,
                                                                null,
                                                                null,
                                                                null,
                                                                null,
                                                                null,
                                                                null,
                                                                null,
                                                                null,
                                                                null,
                                                                null,
                                                                null,
                                                                null,
                                                                null,
                                                                null,
                                                                false,
                                                                false,
                                                                5,
                                                                null,
                                                                null)
      
          return taxonomy
        }
      }
      

      Now as I use this in classic view , it succeeds and the input step gives me the drop down for taxonomy ( the whole list of views), but in blue ocean plugin this fails and gives me an error instead of a dropdown : No component found for PT_SINGLE_SELECT

      The issue obviously is blue ocean just supporting the following types of inputs: https://github.com/jenkinsci/blueocean-plugin/blob/master/blueocean-dashboard/src/main/js/components/parameter/index.js#L10

      It needs to support custom type as well.

            Unassigned Unassigned
            kaulk Kuber Kaul
            Votes:
            14 Vote for this issue
            Watchers:
            17 Start watching this issue

              Created:
              Updated: