Edit

Share via


Variable library CI/CD (preview)

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.

Screenshot of deployment pipeline. :::

The following is important information to remember:

  • All value sets in the variable library are available to all stages of the deployment pipeline, but only one is active in a stage.
  • The active value set for each stage is selected independently and can be changed anytime.
  • By default, when first deployed/commited, the variable librarie's active set is, set to be the default value. You can change this by accessing the newly created variable library in the target stage/repo and changing the active set.

Screenshot of compare in deployment pipelines showing active set. :::

  • While the selected active value set in each stage is unaffected by deployments, the values themselves can be updated in the variable library. The consumer item in its workspace (for example, a pipeline) automatically receives the correct value from the active value set.

The following operations to variables or value sets in one stage of a deployment pipeline, cause the variable library to be reflected as different compared to the same item in a different stage.

  • added, deleted, or edited variables
  • added or deleted value sets
  • names of variables
  • order of variables

Screenshot of compare in deployment pipelines with the variable library showing as different in the two stages.

A simple change to the active value set doesn't register as different when you compare, since the active value set is part of the item configuration, but it is not included in its definition. This is why it is not shown on the Deployment pipeline 'Compare' and not overwritten on each deployment. 

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:

Screenshot of Git folder with variable library files in it.

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.