Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Variable libraries make it easy to manage configurations across different stages of the release pipeline and to save values in Git. This article explains how to use Variable libraries in the context of lifecycle management and CI/CD.
Variable libraries and deployment pipelines
Variable libraries and their values can be deployed in deployment pipelines to manage variable values across different stages. All value sets in the Variable library are available to all stages of the deployment pipeline. The active value set for each stage is selected independently and can be changed anytime. While the selected active value set in each stage is unaffected by deployments, the values themselves can be updated in the deployment pipeline. The consumer item (for example, a pipeline) automatically receives the correct value from the active value set.
When you create a deployment pipeline, you can select a Variable library item to use. The selected Variable library item is stored in the deployment pipeline and is used to populate the variable values in that stage. You can also change the active value set for each stage of the deployment pipeline.
When you change the variables or value set in one stage of a deployment pipeline, the Variable library looks different compared to the same item in a different stage. For example, the following changes in the Variable library are reflected as different in the deployment pipeline:
- added, deleted, or edited variables
- added or deleted value sets
- names of variables
- order of variables
Changes to the active value set don't register as in a different when you compare since the active value set is stored in the deployment pipeline, and not in the Variable library itself.
Variable libraries and Git integration
Like other Fabric items, Variable libraries can be integrated with Git for source control. Variable library items are stored as folders that can be maintained and synced between Fabric and your Git provider.
Item permissions are checked during Git Update and commit.
The Variable library item schema is a JSON object that contains four parts:
- Value sets folder
- Settings
- platform.json: Automatically generated file
- Variables
Value set
The variable library folder contains a subfolder called valueSets. This folder contains a JSON file for each value set. This JSON file contains only the variable values for non default values in that value set. (The default values are in the variables.json file.)
For more information about the value set file, including an example, see value set example.
Values for variables not in this file are taken from the default value set.
Settings
The settings.json file contains settings for the Variable library.
For a sample settings file, see settings.json example.
Variables
The variables.json file contains the variable names and their default values.
For more information about the variables file, including an example, see variables.json example.
Considerations and limitations
Size limitations
- There can be up to 1,000 variables and up to 1,000 value-sets, as long as the total number of cells in the alternative value-sets is under 10,000 cells, and the item’s size not bigger than 1 MB. This is validated when the user saves changes.
- The note field can have up to 2,048 characters.
- The value-set description field can have up to 2,048 characters.
Alternative value set limitations
- Alternative value sets in the Variable library appear in the order they were added. Currently, you can't reorder them in the UI. To change the order, edit the JSON file directly.
- The name of each value set must be unique within the Variable library.
- Variable names must be unique within a Variable library. You can have two variables with the same name in a workspace if they are in different items.
- There's always one and only one active value set in a Variable library at a time. You can't delete the active value set. To delete it, first set another value set to be active. You can set a different active value set for each stage of a deployment pipeline.