target.settableVariables 定義

ステップで設定できる変数に関する制限。

この定義を参照する定義: target

実装

実装 説明
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.

リストの種類

Type 説明
string 変数の設定を、許可される変数の一覧に制限します。

次の例では、ステップは 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

関連項目