{"id":15045183,"url":"https://github.com/jenkinsci/active-choices-plugin","last_synced_at":"2025-09-30T21:31:07.820Z","repository":{"id":31167206,"uuid":"34727393","full_name":"jenkinsci/active-choices-plugin","owner":"jenkinsci","description":"This plugin provides new scripted, dynamic parameters for freestyle jobs that can be rendered as combo-boxes, check-boxes, radio-buttons or rich HTML UI widgets.","archived":false,"fork":true,"pushed_at":"2025-01-14T15:54:34.000Z","size":3526,"stargazers_count":128,"open_issues_count":10,"forks_count":104,"subscribers_count":107,"default_branch":"master","last_synced_at":"2025-01-14T16:43:18.212Z","etag":null,"topics":["parameters","reactive","ui"],"latest_commit_sha":null,"homepage":"https://plugins.jenkins.io/uno-choice","language":"Java","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"biouno/uno-choice-plugin","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jenkinsci.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null}},"created_at":"2015-04-28T11:47:53.000Z","updated_at":"2025-01-14T15:52:59.000Z","dependencies_parsed_at":"2023-09-22T16:02:10.109Z","dependency_job_id":null,"html_url":"https://github.com/jenkinsci/active-choices-plugin","commit_stats":null,"previous_names":[],"tags_count":59,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenkinsci%2Factive-choices-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenkinsci%2Factive-choices-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenkinsci%2Factive-choices-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenkinsci%2Factive-choices-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jenkinsci","download_url":"https://codeload.github.com/jenkinsci/active-choices-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234782967,"owners_count":18885818,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["parameters","reactive","ui"],"created_at":"2024-09-24T20:51:33.379Z","updated_at":"2025-09-30T21:31:02.442Z","avatar_url":"https://github.com/jenkinsci.png","language":"Java","funding_links":[],"categories":["Java"],"sub_categories":[],"readme":"# Active Choices Plug-in\n\n[![Jenkins Plugin](https://img.shields.io/jenkins/plugin/v/uno-choice.svg)](https://plugins.jenkins.io/uno-choice)\n[![GitHub release](https://img.shields.io/github/release/jenkinsci/uno-choice-plugin.svg?label=changelog)](https://github.com/jenkinsci/active-choices-plugin/blob/master/CHANGES.md)\n[![Jenkins Plugin Installs](https://img.shields.io/jenkins/plugin/i/uno-choice.svg?color=blue)](https://plugins.jenkins.io/active-choices)\n[![Jenkins](https://ci.jenkins.io/job/Plugins/job/active-choices-plugin/job/master/badge/icon?subject=Jenkins%20CI)](https://ci.jenkins.io/job/Plugins/job/active-choices-plugin/job/master/)\n[![JIRA issues](https://img.shields.io/static/v1?label=Issue%20tracking\u0026message=component:%20active-choices-plugin\u0026color=blue)](https://issues.jenkins.io/browse/JENKINS-64962?jql=component%20%3D%20%27active-choices-plugin%27%20AND%20resolution%20IS%20EMPTY%20ORDER%20BY%20updated%20DESC)\n\n## Overview\n\nThe Active Choices plugin is used in parametrized freestyle Jenkins jobs to create **scripted, dynamic and interactive\njob parameters**. Active Choices **parameters** can be **dynamically updated** and can be **rendered as combo-boxes,\ncheck-boxes, radio-buttons or rich HTML UI widgets**.\n\nActive Choices parameters are scripted using Groovy, or (optionally) Scriptler Groovy scripts. These custom scripts\nsupport the use of the Jenkins Java API, system environment variables, global node properties, and potentially\nexternal Java and Javascript libraries.\n\nOnce the plugin is installed, three new parameter types become available:\n\n1. Active Choices Parameter\n2. Active Choices Reactive Parameter\n3. Active Choices Reactive Reference Parameter\n\n\u003e **_NOTE:_** The Reactive Reference Parameter allows for parameters to be displayed as\n\u003eformatted HTML. When configuring jobs with this feature, keep in mind how the parameter\nwill be rendered and whether it could be a security issue.\n\n\u003e **_NOTE:_** The plug-in was developed in a way that it relies heavily on the HTML/DOM\n\u003eof the Jenkins UI. We navigate the DOM using JavaScript to create the relationship and\n\u003ereactivity between parameters. Follow [JENKINS-63284](https://issues.jenkins-ci.org/browse/JENKINS-63284)\n\u003efor updates on a version that does not require the UI. When that issue is closed, the\n\u003eplug-in should work fine with Pipelines, DSL, timers, cron, REST-API-triggered jobs, etc.\n\nActive Choices parameters allow users to select value(s) for a job\nparameter. Parameter values can be:\n\n- dynamically generated (using Groovy or a [Scriptler](https://wiki.jenkins-ci.org/display/JENKINS/Scriptler+Plugin)\nscript)\n- dynamically updated based on other UI parameters\n- multi-valued (can have more than one value)\n- rendered with a variety of UI controls, including dynamic HTML (see NOTE above on the security risks)\n\nWe will introduce the Active Choices based UI controls by briefly describing their behavior and rendering\ncharacteristics. We will then provide a guide to their configuration.\n\n## Active Choices Parameter\n\n### Behavior\n\n- An Active Choices parameter dynamically generates a list of value options for a build parameter using a Groovy script\nor a script from the Scriptler catalog.\n\n### Rendering\n\n- Active Choices parameters can be rendered as standard selection lists, check boxes and radio buttons.\n- A text box filter can be optionally shown to aid in filtering the value options.\n\n![](./docs/images/001.jpg)\n\n## Active Choices Reactive and Reactive Reference Parameters\n\nBoth of these parameters have additional useful behaviors and Reactive Reference has some unique rendering options.\n\n### Behavior\n\nSimilar to Active Choices Parameter above:\n\n- Active Choices Reactive and Reactive Reference parameters dynamically generate value options for a build parameter\nusing a Groovy script or a Scriptler script\n\nFurthermore:\n\n- Active Choices Reactive and Reactive Reference parameters can be **dynamically updated**(cascade update) when the\nvalue of other job UI control(s) change(s)\n\n### Rendering Options\n\n#### Active Choices Reactive\n\n- Active Choices Reactive parameters can be rendered as standard selection lists, check boxes and radio buttons.\n- A text box filter can be optionally shown to aid in filtering the value options.\n\n#### Active Choices Reactive Reference\n\nActive Choices Reactive Reference parameters are used to enhance a Jenkins job form UI with reference information.\n\nWith this use case in mind, a Reactive Reference UI control can be rendered as:\n\n- An HTML list (bulleted or numbered)\n- An HTML input text box\n- Dynamically generated HTML (image, iframe, etc.);\n\nThe dynamically generated HTML option, works with any well-formatted HTML returned by the Groovy script. It enables\nrendering of a variety of HTML elements, including **pictures, inline-frames, hyperlinks, richly formatted text** etc.\n\nIn addition, Reactive Reference parameters can be **hidden** from the UI and thus provide the option of dynamically\ngenerating hidden build parameters. These options are further discussed in the Reactive Reference configuration section.\n\n### Rendering Example\n\n![](./docs/images/002.gif)\n\nIn the example above the value options for the 'Professions' parameter get updated when the 'Gender' parameter changes.\n\nIn addition, the Reactive Reference parameter 'Gender_Balance' rendered as a picture is also dynamically updated\nwhen the 'Gender' parameter is updated.\n\n### Behavior and Rendering Summary\n\nThe following table summarizes the behavior and rendering characteristics of the three Active Choices parameter types.\n\n![](./docs/images/003.jpg)\n\n## Active Choices Parameter Type Configuration\n\nThe plug-in includes the following parameter types:\n\n- Active Choices Parameter\n- Active Choices Reactive Parameter\n- Active Choices Reactive Reference Parameter\n\nWe now describe the details of their configuration.\n\n### Active Choices Parameter: Configuration Options (Example 01)\n\n![](./docs/images/004.gif)\n\nAn Active Choices Parameter is configured by setting the following options in the parameter configuration\n\n#### The 'Name' and 'Description'\n\nThese are the typical parameter Name and Description that are common to all Jenkins parameters\n\n#### The 'Script'\n\nThe 'Script' is the **Groovy code or Scriptlet script** that will dynamically generate the parameter value options\n\n- By selecting either of the two radio button options you can either type a Groovy script directly or use a\nScriptler script\n- The script must return a **java.util.List**, an **Array** or a **java.util.Map**, as in the example below:\n\n```groovy\nreturn ['Option 1', 'Option 2', 'Option 3']\n```\n\n#### The 'Fallback Script'\n\nThe 'Fallback Script' configuration option provides alternate parameter value options in case the main Script fails\neither by throwing an Exception, or by not return a `java.util.List`, `Array`, or `java.util.Map`.\n\n#### The 'Choice Type'\n\nThe **'Choice Type**' option provides four different rendering options for the option values:\n\n1. A list box where a single selection is allowed\n2. A list box where multiple selections are allowed\n3. A list of check boxes (multiple selections allowed)\n4. A list of radio buttons (a single selection is allowed)\n\n#### The 'Enable Filter'\n\nThe '**Enable Filter**' option will provide a text box filter in the UI control where a text filter can be typed.\nOnly value options that contain the text are then listed.\n\nThis filer is case independent.\n\n### Active Choices Parameter Rendering (Example 01)\n\nThe 'Example 01' Active Choices parameter configuration generates the following build form UI control. The user can\nselect a single 'State' option from a filterable drop-down list.\n\n![](./docs/images/005.gif)\n\n#### Making 'Default' selections\n\nIt is possible to have some of the options displayed in an Active Choices UI control selected by default when the\ncontrol is initialized.\n\nYou can **define the default value selections** by adding the suffix; **:selected** to the element you want to be\nthe default selection from those returned by the script. In the example below, we will make the State of 'Parana'\nthe default selection when the parameter UI control is rendered.\n\n![](./docs/images/006.gif)\n\n#### Making 'Disabled' selections\n\nYou also can **define disabled selections** by adding the suffix; **:disabled** to the element(s) you want to be\ndisabled. In the example below, we will make various elements to be disabled and immutable.\n\n![](./docs/images/007.png)\n\nAs you can see, both **:selected** and **:disabled** can be specified at the same time.\n\nWe credit the developers of the\n[Dynamic Parameter plugin](https://wiki.jenkins-ci.org/display/JENKINS/Dynamic+Parameter+Plug-in) with some of the\ninitial concepts and code on which Active Choices was implemented. However, there are several important differences and\nimprovements between the Active Choices plugin and the original Dynamic Parameter plugin:\n\n1. An Active Choices parameter can be **rendered** as a multi-select control (combo-box or check-box) allowing users\nto **select more than one value** for the parameter\n2. The parameter **options value list can be filtered**. If the \"**Enable Filters**\" option is checked, an extra input\nbox will be displayed allowing users to filter the options.\n3. You can define a '**fallback**' behavior if the value generator script raises an exception.\n4. You can define **default value selections**in the dynamically generated value list\n\n### Active Choices Reactive Parameter: Configuration Options (Example 02)\n\n![](./docs/images/008.gif)\n\nAn Active Choices Reactive parameter is configured with a set of similar options as those shown above for the Active\nChoices parameter. However, a Reactive parameter provides the additional '**Referenced parameters**' configuration\noption.\n\n- This option, takes a list of job parameters that trigger an **auto-refresh of the Reactive Parameter when any of the\n'Referenced parameters' change**\n\n#### The 'Referenced parameters'\n\nThe '**Referenced parameters**' text field contains **a list of comma separated parameter Names**(from the current job)\nthat will trigger a refresh of the Reactive Parameter when their values change. The values of these parameters are\npassed to the script binding context before the script is re-executed to generate a new set of option values for the\nActive Choices control.\n\n### Active Choices Reactive Parameter Rendering (Example 02)\n\nLet's examine a Jenkins build form rendered with Active Choices parameters that satisfies the following requirements.\nThe form:\n\n- Allows users to select one of several Brazilian States\n- Provides an additional control where a set of Cities belonging to the selected State is dynamically displayed\n- Allows the user to select one or more of the displayed Cities\n\n![](./docs/images/009.gif)\n\nThe job UI has two parameters:\n\n#### 1) States: An Active Choices Parameter\n\nThe first parameter is the **'States'** Active Choices Parameter from 'Example 01'. It allows the user to select one of\nseveral Brazilian States. We could have just as easily used a Jenkins Choice Parameter, but we use an Active Choice\nparameter (as shown from Example 01). The Groovy script for this is:\n\n```groovy\nreturn [\n    'Sao Paulo',\n    'Rio de Janeiro',\n    'Parana',\n    'Acre'\n]\n```\n\n#### 2) Cities: An Active Choices Reactive Parameter\n\nThe second parameter is the **'Cities'** Active Choices Reactive Parameter that **dynamically displays** a set of cities\nbelonging to the selected State and allows users to select multiple values. The 'Cities' parameter configuration is shown\nabove in 'Example 02'.\n\nNote that:\n\n- The 'Cities' Reactive parameter references the previously defined States parameter ('Referenced parameters'=States);\n- The 'Choice Type' is set to 'Check Boxes'.This will allow the user to select one or more 'Cities' by selecting multiple\ncheck boxes.\n- A custom 'Groovy Script' will be used to generate the 'Cities' value options as shown below (the last list value\nreturned by the script)\n\n```groovy\nif (States == \"Sao Paulo\") {\n  return [\"Barretos\", \"Sao Paulo\", \"Itu\"]\n} else if (States == \"Rio de Janeiro\") {\n  return [\"Rio de Janeiro\", \"Mangaratiba\"]\n} else if (States == \"Parana\") {\n  return [\"Curitiba\", \"Ponta Grossa\"]\n} else if (States == \"Acre\") {\n  return [\"Rio Branco\", \"Acrelandia\"]\n} else {\n  return [\"Unknown state\"]\n}\n```\n\nWhenever the user changes the option of the States parameter, the 'Cities' parameter will get dynamically updated. Note\nhow that the **'States'** referenced parameter is in the script binding and can be used directly.\n\nYou can use a Reactive parameter type for things like displaying the list of Maven artifacts, given a group ID.\n\n### Active Choices Reactive Reference Parameter: Configuration Options\n\n![](./docs/images/010.gif)\n\nA Reactive Reference parameter is configured with a set of similar options as those shown above for the Active Choices\nReactive parameter.\n\nHowever, a **Reactive Reference parameter provides a unique set of rendering options** (see 'Choice Type').\n\n- Input text box\n- Numbered list\n- Bullet items list\n- Formatted HTML\n- Formatted Hidden HTML\n\nGiven the wide variety of rendering options the Active Choices Groovy script must return the following types of\nvariables for each option:\n\n| Choice Type     | Groovy Returns | Comment                                                                             |\n|----------------------|----------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Input text box    | String     | The return String appears in a simple text box                                                          |\n| Numbered list    | List      | The return List displays as a numbered list                                                           |\n| Bullet items list  | List      | The return List displays as a bulleted list                                                           |\n| Formatted HTML    | String     | The return String must be well formatted HTML to display correctly. You can include any HTML tags here, e.g.: some \u003ctable\\\u003e, or a \u003cform\\\u003e to another web site. |\n| Formatted Hidden HTM | String     | The parameter won't be displayed in the UI                                                            |\n\nA typical application of a Reactive Reference parameter is to dynamically display reference information that can be\nused to guide the user in making an appropriate value selection of another job parameter.\n\nBy design, the values of Reactive Reference parameters are NOT passed to the build environment with one important\nexception. When the choice type is set to **Formatted HTML** or **Formatted Hidden HTML** and the HTML is an 'input'\nelement the value can be passed to the build. See the 'Advanced Usage' section for additional instructions.\n\n### Example Configuration: Active Choices Reactive Reference Parameter\n\nBelow we present 3 examples of Reactive References with different Choice Types and their corresponding renderings in\nthe Jenkins job UI.\n\n![](./docs/images/011.gif)\n\nConsider an example where the user needs to make a meal selection that complements the available wine selection.\nThe food selection would be easier if some useful reference info could be offered when users considered a particular\nwine. We call this reference information the 'WINE_RULE' and we can easily implement it using a Reactive Reference\nparameter.\n\nThe 'WINE_RULE' gets automatically updated when a user makes a new selection from the 'WINE_MENU' (Note Referenced\nparameters=WINE_MENU). As a result, when we make a 'WINE_MENU' selection we also get a 'WINE_RULE' that can guide the\n'FOOD_MENU' selection.\n\n![](./docs/images/012.gif)\n\n### Reactive Reference Configuration (Example 03)\n\nThe complete configuration of the 'WINE_RULE' parameter is shown below.\n\n![](./docs/images/013.png)\n\n### Reactive Reference Groovy script (Example 03)\n\nThe groovy script that generates the 'WINE_RULE' **formatted HTML** for each of the choices is shown below.\n\n```groovy\nswitch(WINE_MENU) {\n  case ~/.*Champagne.*/:\n    winerec='Champagne is perfect with anything salty'\n    return \"\u003cb\u003e${winerec}\u003c/b\u003e\"\n  case ~/.*Sauvignon Blanc.*/:\n    winerec='Sauvignon Blanc goes with tart dressings and sauces'\n    return \"\u003cb\u003e${winerec}\u003c/b\u003e\"\n  case ~/.*Grüner Veltliner.*/:\n    winerec='Choose Grüner Veltliner when a dish has lots of fresh herbs'\n    return \"\u003cb\u003e${winerec}\u003c/b\u003e\"\n  case ~/.*Pinot Grigio.*/:\n    winerec='Pinot Grigio pairs well with light fish dishes'\n    return \"\u003cb\u003e${winerec}\u003c/b\u003e\"\n  case ~/.*Chardonnay.*/:\n    winerec='Choose Chardonnay for fatty fish or fish in a rich sauce'\n    return \"\u003cb\u003e${winerec}\u003c/b\u003e\"\n  case ~/.*Off-Dry Riesling.*/:\n    winerec='Off-Dry Riesling pairs with sweet \u0026 spicy dishes'\n    return \"\u003cb\u003e${winerec}\u003c/b\u003e\"\n  case ~/.*Moscato dAsti.*/:\n    winerec='Moscato dAsti loves fruit desserts'\n    return \"\u003cb\u003e${winerec}\u003c/b\u003e\"\n  case ~/.*dry Rosé.*/:\n    winerec='Pair a dry Rosé with rich, cheesy dishes'\n    return \"\u003cb\u003e${winerec}\u003c/b\u003e\"\n  case ~/.*Pinot Noir.*/:\n    winerec='Pinot Noir is great for dishes with earthy flavors'\n    return \"\u003cb\u003e${winerec}\u003c/b\u003e\"\n}\n```\n\n## Advanced Usage Notes\n\n### Considerations while writing your Groovy script\n\nYour Groovy script binding has access to two additional variables for use:\n\n- `jenkinsProject` -\u003e The Jenkins Project object\n- `jenkinsBuild` -\u003e The Jenkins Build object\n\n### Passing Reactive Reference Values to the build\n\nAs was mentioned earlier, in general the values of reactive reference parameters are not passed to the build. However,\nthere are some scenarios where the ability to pass these values would be of interest. For a more extensive discussion\nof this feature you can read\n[here](https://github.com/biouno/uno-choice-plugin/wiki/Using-Uno-Choice-for-Dynamic-Input-Text-Box-Defaults).\n\n#### Scenario 1: Pass a dynamically created value that can be edited by the user\n\nIn this scenario, we want to provide the user a dynamic default value that is also editable. This can be accomplished\nwith the following reactive reference configuration:\n\n- Choice Type: **Formatted HTML**\n- Groovy Script returning an **HTML input element** with the dynamic default value\n- Advanced Option set to\n\n![](./docs/images/014.png)\n\n#### Scenario 2: Pass a dynamically created value that is **hidden** (can't be edited by the user)\n\nIn this scenario, we want **the build to have access to a dynamic parameter generated from user input/option\nselections** in the UI. The parameter is created programmatically, and is not user-editable. This can be accomplished\nwith the following reactive reference configuration:\n\n- Choice Type: **Formatted Hidden HTML**\n- Groovy Script returning an **HTML input element** with the dynamic default value\n- Advanced Option set to\n\n![](./docs/images/015.png)\n\nA 'Formatted Hidden HTML' Choice type is useful when you want to calculate values to use in the build, but these values\nshould not be modified by the user(e.g. to compute the deploy URL).\n\nIn both scenarios the groovy script must return an HTML element formatted as follows:\n\n```groovy\nreturn \"\u003cinput name='value' value='${ReactiveRefParam}' class='setting-input' type='text'\u003e\"\n```\n\n**ReactiveRefParam** is the Reactive Reference value that will be passed to the build\n\n#### Scenario 3: Create an input control with dynamic HTML and pass its value to the build\n\nThis is an interesting application of the Reactive Reference parameter. It allows you to create custom UI parameter\ncontrols with improved interactivity. See\n[example](https://wiki.jenkins-ci.org/display/JENKINS/Reactive+Reference+Dynamic+Parameter+Controls)\n\n### Advanced Option: Omit Value Field\n\nBy default, 'Reactive References' pass to the build a hidden `\u003cinput name=\"value\" value=\"\"\u003e`. It means that your 'Reactive\nReference' parameter will always be empty, but you can use a 'Formatted HTML' parameter and instruct the plug-in to not\ninclude this hidden value parameter.\n\nYou can click the 'Advanced' button and there you will find an option to omit the value field. This will you let you\ndefine a value for the hidden parameter.\n\n![](./docs/images/016.gif)\n\n### Using Active Choices with Scriptler scripts\n\nWe assume users that need to use Scriptler generated parameters are already familiar with the Scriptler Plug-in. If\nyou need further information on how to use the Scriptler Plug-in, please refer to\n[its Wiki page](https://wiki.jenkins-ci.org/display/JENKINS/Scriptler+Plugin) first.\n\nSimilar to a Groovy script, a Scriptler script is also written in Groovy and used to render the parameter. Your\nScriptler script must return a `java.util.List`, `Array`, or `java.util.Map` for Active Choices and Reactive\nparameters, or custom HTML elements for the Reactive Reference parameter. Note that the value of other build parameters\n(when using Scriptler in combination with Active Choices) will be available in the Scriptler script context. You do not\nneed to define such parameters in the Scriptler interface, or during the job definition.\n\nHowever, **the main advantage that the Scriptler Plug-in** provides is the creation of a **reusable** **Groovy script\ncatalog** that can be used across multiple jobs or even for automation.\n\nTo make your Scriptler scripts reusable across multiple projects you should parameterize them and assign script\nparameters using build parameters.\n\n#### Example\n\n`Environments.groovy` in Scriptler\n\n```groovy\nreturn [\"Select:selected\", \"DEV\", \"TEST\", \"STAGE\", \"PROD\"]\n```\n\n`HostsInEnv.groovy` in Scriptler\n\n```groovy\n// Static content examples. These lists can be generated dynamically as an alternative.\nList devList  = [\"Select:selected\", \"dev1\", \"dev2\"]\nList testList  = [\"Select:selected\", \"test1\", \"test2\", \"test3\"]\nList stageList = [\"Select:selected\", \"stage1\"]\nList prodList  = [\"Select:selected\", \"prod1\", \"prod2\", \"prod3\", \"prod4\"]\n\nList default_item = [\"None\"]\n\nif (Environment == 'DEV') {\n  return devList\n} else if (Environment == 'TEST') {\n  return testList\n} else if (Environment == 'STAGE') {\n  return stageList\n} else if (Environment == 'PROD') {\n  return prodList\n} else {\n  return default_item\n}\n```\n\nPipeline in `Jenkinsfile`\n\n```groovy\nproperties([\n  parameters([\n    [\n      $class: 'ChoiceParameter',\n      choiceType: 'PT_SINGLE_SELECT',\n      name: 'Environment',\n      script: [\n        $class: 'ScriptlerScript',\n        scriptlerScriptId:'Environments.groovy'\n      ]\n    ],\n    [\n      $class: 'CascadeChoiceParameter',\n      choiceType: 'PT_SINGLE_SELECT',\n      name: 'Host',\n      referencedParameters: 'Environment',\n      script: [\n        $class: 'ScriptlerScript',\n        scriptlerScriptId:'HostsInEnv.groovy',\n        parameters: [\n          [name:'Environment', value: '$Environment']\n        ]\n      ]\n   ]\n ])\n])\n\npipeline {\n  agent any\n  stages {\n    stage('Build') {\n      steps {\n        echo \"${params.Environment}\"\n        echo \"${params.Host}\"\n      }\n    }\n  }\n}\n```\n\n### Filter Supports Regular Expressions\n\nNote that although the text 'Filter' box available for Active Choices parameters provides easy, case-insensitive\nfiltering by simply typing some text, it also supports more sophisticated filtering using regular expressions.\n\nThe following example shows such an example where a complex options list is filtered using a regular expression.\n \n![](./docs/images/017.jpg)\n\n## Security\n\nActive Choices versions before v2.0 may not be safe to use. Please review the following warnings before using an older\nversion:\n\n- [Arbitrary code execution vulnerability](https://jenkins.io/security/advisory/2017-04-10/)\n- [Stored cross-site scripting vulnerability](https://jenkins.io/security/advisory/2017-10-23/)\n\nStarting with Active Choices v2.0, sandboxed Groovy scripts for Active Choices Reactive Reference Parameter will **no\nlonger emit HTML that is considered unsafe**, such as `\u003cscript\u003e` tags. This may result in behavior changes on\n*Build With Parameters* forms, such as missing elements. To resolve this issue, Groovy scripts emitting HTML will need\nto be configured to run outside the script security sandbox, possibly requiring separate administrator approval in\n*In-Process Script Approval*.\n\nActive Choices will load two extra Javascript files, JQuery and `unochoice.js`.\n\n## Languages Supported\n\n1. English\n2. Portuguese (Brazil)) *Work-In-Progress*\n3. If you want to include your language, send us a pull request with the `messages.properties` files or get in touch!\n\n## Known Limitations\n\n1. The parameters are supposed to be handled only by humans, and at the moment do not work when the job is triggered\nby plug-ins, API or scripts. Please see [this issue](https://issues.jenkins-ci.org/browse/JENKINS-28735) for more.\n2. Before filing issues, please take a look at the\n[Troubleshooting Page](https://wiki.jenkins.io/display/JENKINS/Troubleshooting)\n\n## Release Notes\n\nSee the [CHANGES.md](https://github.com/jenkinsci/active-choices-plugin/blob/master/CHANGES.md) file.\n\n## Sponsors\n\nFor commercial support, please get contact us via [@tupilabs](https://twitter.com/tupilabs).\n\n![](./docs/images/018.png)\n\nFor more about where the plug-in came from, check out the [BioUno project](http://biouno.org).\n\n![](./docs/images/019.png)\n\nGet in touch if you would like to sponsor the development of the plug-in, or an open issue in JIRA.\n\n## Other Resources\n\n- “Dynamic and reactive parameterization in Jenkins pipelines using HTML, Groovy, and Bash” by _Esteban Echavarria Collazos_ - [link](https://medium.com/globant/dynamic-and-reactive-parameterization-in-jenkins-pipelines-using-html-groovy-and-bash-27b031fcd69b)\n\nCheck out a list of articles, tutorials, and publications at the [BioUno website](http://biouno.org/publications.html)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjenkinsci%2Factive-choices-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjenkinsci%2Factive-choices-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjenkinsci%2Factive-choices-plugin/lists"}