You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/platform/variables-and-expressions/runtime-input-usage.md
+41-22Lines changed: 41 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -176,7 +176,7 @@ Pipelines fails if a variable's default value starts with `*`. This includes run
176
176
Use allowed values to provide a fixed range of acceptable values for a runtime input.
177
177
178
178
<Tabs>
179
-
<TabItem value="Visual" label="Visual">
179
+
<TabItem value="Visual" label="Visual" default>
180
180
181
181
1. In the Pipeline Studio's Visual Editor, use the **Value type selector** to select **Runtime Input**.
182
182
@@ -200,24 +200,40 @@ Use allowed values to provide a fixed range of acceptable values for a runtime i
200
200
6. If you also specify a [default value](#default-values), you must include the default value in your allowed values.
201
201
7. Select **Submit**.
202
202
203
+
If you are having any trouble resolving allowed values in runtime inputs ( e.g., if you are using JSON in allowed values and are unable to resolve them, or with array-type fields such as file paths), please check how the allowed values are configured in the YAML section of [set allowed values](#set-allowed-values).
204
+
203
205
</TabItem>
204
-
<TabItem value="YAML" label="YAML" default>
206
+
<TabItem value="YAML" label="YAML" >
207
+
208
+
:::caution Deprecated Method
209
+
210
+
We have introduced a new functor [`.selectManyFrom()`](#multi-selection), which is mapped to multi-selection for runtime inputs. The release of the new functor has deprecated the `.allowedValues()` functor.
211
+
212
+
Exactly as before, the allowed values method still behaves like [`.selectOneFrom()`](#single-selection) (single selection) unless the feature flag `PIE_MULTISELECT_AND_COMMA_IN_ALLOWED_VALUES` is enabled, in which case it is used to perform multi selection.
213
+
214
+
With this update:
215
+
- Use [`.selectManyFrom()`](#multi-selection) for selecting multiple values
216
+
- Use [`.selectOneFrom()`](#single-selection) for selecting a single value
217
+
218
+
219
+
**Existing pipelines using `.allowedValues()` will continue to work, but editing runtime inputs in Pipeline Studio will update the YAML to use the new functors, which may affect automation and testing.**
220
+
:::
205
221
206
-
When writing pipelines in YAML, define allowed values by appending the `.allowedValues()` method to `<+input>`. For example: `<+input>.allowedValues(bengaluru,newyork)`.
222
+
When writing pipelines in YAML, define allowed values by appending the `.selectOneFrom()` or `selectManyFrom()` method to `<+input>`. For example: `<+input>.selectOneFrom(bengaluru,newyork,california)`or `<+input>.selectManyFrom(bengaluru,newyork,california)` depending upon whether you want to allow [single selection](#single-selection) or [multi selection](#multi-selection).
207
223
208
-
If your values include commas, you must escape the value strings using the format `\'VALUE\'`. For example: `<+input>.allowedValues(\'bengaluru,india\',\'newyork,usa\',\'london,uk\')`.
224
+
Please note that `.allowedValues(bengaluru,newyork,california)` will work as well, but it is a deprecated method and therefore we recommend using [`.selectManyFrom()`](#multi-selection) or [`.selectOneFrom()`](#single-selection) functors.
209
225
210
-
If you specify allowed values *and* a [default value](#default-values), the default value must be present in the list of allowed values. To specify both an allowed value and a default value, append both the `.default()` and `.allowedValues()` methods to `<+input>`, and make sure the list of allowed values includes the default value. For example: `<+input>.default(london).allowedValues(bengaluru,newyork,london)`.
226
+
If your values include commas, you must escape the value strings using the format `\'VALUE\'`. For example: `<+input>.selectManyFrom(\'bengaluru,india\',\'newyork,usa\',\'london,uk\')`.
211
227
212
-
In order to allow empty values to be included in the allowed values list, add a comma followed by nothing. For example: `<+input>.allowedValues(bengaluru,newyork,)`will allow an empty value to be an input for this variable.
228
+
If you want to specify allowed values and a [default value](#default-values), the default value must be present in the list of allowed values. To specify both an allowed value and a default value, append both the `.default()` and `.selectOneFrom()` or `.selectManyFrom()` methods to `<+input>`, and make sure the list of allowed values includes the default value. For example: `<+input>.default(london).selectManyFrom(bengaluru,newyork,london)`.
229
+
230
+
In order to allow empty values to be included in the allowed values list, add a comma followed by nothing. For example: `<+input>.selectManyFrom(bengaluru,newyork,)`will allow an empty value to be an input for this variable.
213
231
214
232
:::info
215
233
216
234
The option to allow empty values is behind the feature flag `CDS_INCLUDE_EMPTY_VALUE`. Contact [Harness Support](mailto:[email protected]) to enable it.
217
235
218
236
:::
219
-
</TabItem>
220
-
</Tabs>
221
237
222
238
---
223
239
@@ -228,51 +244,54 @@ If you use runtime input with allowed values in JSON, use double quotes as neces
228
244
For example, these expressions both resolve to `{x:y}`:
229
245
230
246
```
231
-
<+input>.allowedValues({"x":"y"})
232
-
"<+input>.allowedValues({x:y})"
247
+
<+input>.selectOneFrom({"x":"y"})
248
+
"<+input>.selectOneFrom({x:y})"
233
249
```
234
250
235
251
If you needed the allowed values to include quotes, such as `{"x": "y"}`, then you need to escape the quotes in the allowed values. For example:
236
252
237
253
```
238
-
"<+input>.allowedValues({\\\"x\\\": \\\"y\\\"})"
254
+
"<+input>.selectOneFrom({\\\"x\\\": \\\"y\\\"})"
239
255
```
240
256
241
257
:::
242
258
243
259
244
260
:::info note
245
261
246
-
When using `allowedValues` with runtime inputs in array-type fields (e.g., file paths), errors may occur during deployment as the system might not correctly process these inputs.
262
+
When using `allowedValues` , `selectManyFrom` or `selectOneFrom` with runtime inputs in array-type fields (e.g., file paths), errors may occur during deployment as the system might not correctly process these inputs.
247
263
248
-
Fields like paths in ECS Task Definitions and valuesPaths in Kubernetes services do not support runtime inputs in array format. Expressions like `<+input>.allowedValues(<+variable1>, <+variable2>)` can lead to deployment failures
264
+
Fields like paths in ECS Task Definitions and valuesPaths in Kubernetes services do not support runtime inputs in array format. Expressions like `<+input>.selectManyFrom(<+variable1>, <+variable2>)` can lead to deployment failures
249
265
250
266
**Workaround:-**
251
-
Define a variable (e.g., FILE_PATH_VAR) at the pipeline or service level, assign it a value using `allowedValues`, and reference this variable in the configuration. This approach ensures the input is treated as a string.
267
+
Define a variable (e.g., FILE_PATH_VAR) at the pipeline or service level, assign it a value using `allowedValues`, `selectManyFrom` or `selectOneFrom`, and reference this variable in the configuration. This approach ensures the input is treated as a string.
252
268
253
269
**Recommendation:-**
254
-
Avoid using `allowedValues` with runtime inputs in list fields and use the suggested workaround to ensure proper functionality
270
+
Avoid using `allowedValues` , `selectManyFrom` or `selectOneFrom` with runtime inputs in list fields and use the suggested workaround to ensure proper functionality
255
271
256
272
:::
257
273
274
+
</TabItem>
275
+
</Tabs>
276
+
258
277
## Allow Multi Selection and Single selection
259
278
260
279
261
-
You can select a **Mode** of selection while creating allowed values in Runtime Input:-
280
+
You can select a **Mode** of selection while creating allowed values in Runtime Input
262
281
263
282

264
283
265
284
### Multi Selection
266
285
267
-
:::note
268
-
Currently, multiple selection for runtime inputs is behind the feature flag `PIE_MULTISELECT_AND_COMMA_IN_ALLOWED_VALUES`. Contact [Harness Support](mailto:[email protected]) to enable the feature.
286
+
:::info note
287
+
Multi Selection mode now by default maps to the `.selectManyFrom()` functor. This feature update is not behind a feature flag and is generally available.
269
288
:::
270
289
271
-
You can use Multi Selection if you want to choose one or more values from the list of [allowed values](#set-allowed-values). Multi Selection maps to the `.allowedValues()` functor, and Single Selection maps to the
272
-
`.selectOneFrom()`functor. You can use multiple selection for runtime inputs in pipelines, stages, and shell script variables only. Multiple selection is an extension of allowed values, so you must specify allowed values to use it.
290
+
:::caution DEPRECATED
291
+
Multiple selection for runtime inputs by leveraging the `.allowedValues()` which is behind the feature flag `PIE_MULTISELECT_AND_COMMA_IN_ALLOWED_VALUES` is **deprecated**.
292
+
:::
273
293
274
-
For users who want to migrate to single selection, you can implement
275
-
`.selectOneFrom()`even before the FF `PIE_MULTISELECT_AND_COMMA_IN_ALLOWED_VALUES` is turned on.
294
+
You can use Multi Selection if you want to choose one or more values from the list of [allowed values](#set-allowed-values). Multi Selection by default maps to the `.selectManyFrom()` functor and Single Selection maps to the [`.selectOneFrom()`](#single-selection) functor. You can use multiple selection for runtime inputs in pipelines, stages, and shell script variables only. You must specify multiple allowed values to use it.
0 commit comments