可按步骤设置的变量的限制。
引用此定义的定义: 目标
实现
执行 | DESCRIPTION |
---|---|
settableVariables: none | 禁用设置任何变量的步骤。 |
settableVariables:字符串列表 | 将变量设置限制为允许的变量列表。 |
注解
可以禁用为步骤设置所有变量,或将可设置的变量限制为列表。 如果未设置属性 settableVariables
,则默认值允许按步骤设置所有变量。
settableVariables: none
禁用设置任何变量的步骤。
settableVariables: none # Disable a step from setting any variables.
settableVariables
字符串。 允许的值:无。
禁用设置任何变量的步骤。
例子
steps:
- script: echo This is a step
target:
settableVariables: none
settableVariables:字符串列表
限制设置不在指定列表中的任何变量的步骤。
settableVariables: [ string ] # Restrict variable setting to a list of allowed variables.
列表类型
类型 | DESCRIPTION |
---|---|
字符串 | 将变量设置限制为允许的变量列表。 |
例子
在以下示例中,该 bash
步骤只能设置变量的值 sauce
。 管道运行时, secretSauce
未设置变量,并在管道运行页上显示警告。
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