Manage Values in YAML
You can manage values separately from your DevOps as Code YAML files so that they can be pulled in when applying XL YAML files. DevOps as Code supports multiple methods to configure and manage values including a dedicated file format using the .xlvals extension, environment variables or by explicitly specifying a value in XL CLI command syntax.
Methods to manage values
Each of the following methods are parsed in the order presented below.
- Method 1: One or more
.xlvalsfiles in the/.xebialabsfolder in your home directory. Multiple files in this folder are parsed in alphabetical order. - Method 2: One or more
.xlvalsfiles in your project directory alongside your YAML files.- A YAML file can only parse
.xlvalsfiles stored in the same directory. - You can have a YAML file stored at a higher level in the directory structure that imports one or more YAML files that reside in a subdirectory. However, any
.xlvalsfiles related to a YAML file in a subdirectory must be in the same directory. - Multiple
.xlvalsfiles in this directory are parsed in alphabetical order.
- A YAML file can only parse
- Method 3: Environment variables that are prefixed with
XL_VALUE_; for example,XL_VALUE_mykey=myvalue. - Method 4: Invoked explicitly as a parameter when using the XL CLI; for example, by adding the global flag
--values mykey=myvalue.
How value methods are parsed
The XL CLI will parse the methods for managing values in the order implied in the method order described above.
- If there are multiple
.xlvalsfiles in a directory, each file will be parsed in alphabetical order. - If you have multiple environment variables defined that are prefixed with
XL_VALUE_, each variable will be parsed in alphabetical order. - If a duplicate key is encountered as parsing continues through the method order, the last encountered key is used. For example, if you have a value defined for
USERin an.xlvalsfile in your.xebialabsdirectory (method 1), and you have the different value forUSERdefined in an.xlvalsfile in your project directory (method 2), then the value in the project directory is used and the value in the.xebialabsdirectory is ignored.
.xlvals file format
An .xlvals file is simply a list of keys and values, and follows the standard implementation of the Java .properties file format.
Here is an example of key/value definitions using the = delimiter:
# my keys and values
appversion=1.0.2
environmentName=myenv
hostname=myhostname
port=443