Recently, we introduced support for default values in custom pipeline variables. Today, we're happy to announce the ability to make pipeline variables configuration more flexible with predefined values.
We added a property to predefine values that can be assigned to a variable. It helps avoid errors, and improves the user experience. Instead of typing a variable value, you can choose it from a dropdown.
Here is an example of a pipeline configuration with the allowed-values
property showing how to restrict values for an environment variable:
pipelines:
custom:
run-test-for-environment:
- variables:
- name: Environment
default: production
allowed-values: # optionally restrict variable values
- dev
- staging
- production
- step:
script:
- echo "environment is $Environment"
Now, in the "Run pipeline" dialog, the user will have to choose a variable from a predefined list.
![](https://bitbucket.wpengine.com/wp-content/uploads/2022/02/pipeline-predefined-variables-1024x816.png)
Additional documentation on using variables in custom pipelines can be found here. We hope you and your team find this extra flexibility helpful!
Happy coding!