Extensible Choice Parameter

This plugin is up for adoption! We are looking for new maintainers. Visit our Adopt a Plugin initiative for more information.

Older versions of this plugin may not be safe to use. Please review the following warnings before using an older version:

This plugin adds "Extensible Choice" as a build parameter.You can select how to retrieve choices, including the way to share choices among all jobs.

Note

For pipeline users:

Editable Choice plugin is available and designed pipeline friendly. Please try that for pipelines.

Extensible Choice Parameter plugin is designed for GUI-based jobs like freestyle projects, matrix projects and so on. It’s not planned to support pipeline syntaxes.

What’s this?

This plugin provides a Extensible Choice parameter:

  • When building, the value can be selected with a dropdown like a built-in Choice parameter.

  • The choices can be provided in several ways:

    • Global Choice Parameter: defines choices in the Configure System page.

      • Choices can be shared by multiple jobs.

      • Updating the choices in the Configure System, every job can immediately refer the updated choices.

    • Textarea Choice Parameter: writes choices in a textarea, just like a built-in Choice parameter.

    • System Groovy Script Choice Parameter: runs a System Groovy script to determine the list of choices

    • File Choice Parameter: lists files in a directory.

  • Checking Editable checkbox allows you to specify any value, even one not in the choices.

    • Edited values can be added to the choice used next time automatically by checking "Add Edited Value".

  • You can add a new way to provide choices with Extension Points.

Disabling providers

Some choice providers may cause security issues in your system:

Choice Provider Security Issue Note

File Choice Parameter

Any users with project configuration privilege can list files in the OS with the privilege of the OS user Jenkins run with.

Users can do that also with "Execute shell" or "Execute Windows Batch" build step.

You can disable specific providers in system configuration page:

Global configuration

In the above screen, System Groovy Script Choice Parameter (unchecked one) is disabled.

Screenshots

  • "Extensible Choice" is added as a type of build parameters.
    Add Parameter

  • You can select the way to define choices of the parameter.
    Choice Provider

    • A new way to provide choices can be added with Extension Points.

  • Selecting "Textarea Choice Parameter", you can define choices like the built-in Choice parameter.
    Textarea Choice Parameter

  • "Global Choice Parameter" enables you to select a set of choices from the ones defined in System Configuration page.

    • Defining in System Configuration page:
      Global Choice Parameter in System Configuration

    • Select which set of choices to use:
      Global Choice Parameter

  • "System Groovy Choice Parameter" generate choices with a Groovy script:
    System Groovy Choice Parameter

  • "File Choice Parameter" enables select a file in a specified directory:
    File Choice Parameter

  • You can specify its default value. This is useful with Global Choice Parameter to specify different default values in jobs:
    Default Choice

  • Checking "Editable" enables you to input a value not in choices at build time:
    Editable

    • Textarea Choice Parameter and Global Choice Parameter provides "Add Edited Value", which automatically adds a value not in the choice list:
      Add Edited Value

Extension point

A new way to provide choices can be added with extending ChoiceListProvider, overriding the following method:

abstract public List<String> getChoiceList()

Issues

To report a bug or request an enhancement to this plugin please create a ticket in JIRA (you need to login or to sign up for an account). Also have a look on How to report an issue