target.settableVariables definition

Restrictions on which variables that can be set by a step.

Definitions that reference this definition: target

Implementations

Implementation Description
settableVariables: none Disable a step from setting any variables.
settableVariables: string list Restrict variable setting to a list of allowed variables.

Remarks

You can disable setting all variables for a step, or restrict the settable variables to a list. If the settableVariables property is not set, the default allows all variables to be set by a step.

settableVariables: none

Disable a step from setting any variables.

settableVariables: none # Disable a step from setting any variables.

settableVariables string. Allowed values: none.

Disable a step from setting any variables.

Examples

steps:
- script: echo This is a step
  target:
    settableVariables: none

settableVariables: string list

Restrict a step from setting any variables not in the specified list.

settableVariables: [ string ] # Restrict variable setting to a list of allowed variables.

List types

Type Description
string Restrict variable setting to a list of allowed variables.

Examples

In the following example, the bash step can only set the value of the sauce variable. When the pipeline runs, the secretSauce variable is not set, and a warning is displayed on the pipeline run page.

steps:
  - bash: |
      echo "##vso[task.setvariable variable=sauce;]crushed tomatoes"
      echo "##vso[task.setvariable variable=secretSauce;]crushed tomatoes with garlic"
    target:
     settableVariables:
      - sauce
    name: SetVars
  - bash: 
      echo "Sauce is $(sauce)"
      echo "secretSauce is $(secretSauce)"
    name: OutputVars

See also