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

Workflow Snippet Generator - Incorrect format for Input with Choice Parameter

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved (View Workflow)
    • Minor
    • Resolution: Fixed
    • core

    Description

      Snippet generator generates an array:

      input id: 'Cc2a7d4d888ad098e3ca0ed7599d887d', message: 'Which environment?', ok: 'Submit', parameters: [[$class: 'ChoiceParameterDefinition', choices: ['Red', 'Blue', 'Green'], description: '', name: 'env']]
      

      ChoiceParameterDefinition requires a delimited string.

      Workaround by modifying the snippet code by converting array to string with "\n" separator, e.g.:

      input id: 'Cc2a7d4d888ad098e3ca0ed7599d887d', message: 'Which environment?', ok: 'Submit', parameters: [[$class: 'ChoiceParameterDefinition', choices: 'Red\nBlue\nGreen', description: '', name: 'env']]
      
      

      Or just join the Array elements:

      input id: 'Cc2a7d4d888ad098e3ca0ed7599d887d', message: 'Which environment?', ok: 'Submit', parameters: [[$class: 'ChoiceParameterDefinition', choices: ['Red', 'Blue', 'Green'].join('\n'), description: '', name: 'env']]
      

      Attachments

        Issue Links

          Activity

            People

              danielbeck Daniel Beck
              nharniman Nigel Harniman
              Votes:
              38 Vote for this issue
              Watchers:
              43 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: