次の方法で共有


steps.pwsh の定義

pwsh 手順では、Windows、macOS、Linux の PowerShell Core でスクリプトを実行します。

steps:
- pwsh: string # Required as first property. Inline PowerShell script.
  errorActionPreference: string # Unless otherwise specified, the error action preference defaults to the value stop. See the following section for more information.
  failOnStderr: string # Fail the task if output is sent to Stderr?
  ignoreLASTEXITCODE: string # Check the final exit code of the script to determine whether the step succeeded?
  workingDirectory: string # Start the script with this working directory.
  condition: string # Evaluate this condition expression to determine whether to run this task.
  continueOnError: boolean # Continue running even on failure?
  displayName: string # Human-readable name for the task.
  target: string | target # Environment in which to run this task.
  enabled: boolean # Run this task when the job runs?
  env: # Variables to map into the process's environment.
    string: string # Name/value pairs
  name: string # ID of the step.
  timeoutInMinutes: string # Time to wait for this task to complete before the server kills it.
  retryCountOnTaskFailure: string # Number of retries if the task fails.
steps:
- pwsh: string # Required as first property. Inline PowerShell script.
  errorActionPreference: string # Unless otherwise specified, the error action preference defaults to the value stop. See the following section for more information.
  failOnStderr: string # Fail the task if output is sent to Stderr?
  ignoreLASTEXITCODE: string # Check the final exit code of the script to determine whether the step succeeded?
  workingDirectory: string # Start the script with this working directory.
  condition: string # Evaluate this condition expression to determine whether to run this task.
  continueOnError: boolean # Continue running even on failure?
  displayName: string # Human-readable name for the task.
  target: string | target # Environment in which to run this task.
  enabled: boolean # Run this task when the job runs?
  env: # Variables to map into the process's environment.
    string: string # Name/value pairs
  name: string # ID of the step.
  timeoutInMinutes: string # Time to wait for this task to complete before the server kills it.

この定義を参照する定義: 手順

特性

pwsh 文字列。 最初のプロパティとして必要です。
インライン PowerShell スクリプトを します。

errorActionPreference 文字列。
特に指定しない限り、エラー アクションの基本設定は既定で値の停止になります。 詳細については、次のセクションを参照してください。

failOnStderr 文字列。
出力が Stderr に送信された場合、タスクが失敗しますか?

ignoreLASTEXITCODE 文字列。
スクリプトの最後の終了コードを確認して、ステップが成功したかどうかを判断しますか?

workingDirectory 文字列。
この作業ディレクトリでスクリプトを開始します。

condition 文字列。
この条件式を評価して、このタスクを実行するかどうかを決定します。

ブールを します。
障害が発生しても実行を続行しますか?

displayName 文字列。
タスクの人間が判読できる名前を します。

ターゲットtargetします。
このタスクを実行する環境です。

ブールを します。
ジョブの実行時にこのタスクを実行しますか?

文字列ディクショナリ env します。
変数を使用して、プロセスの環境にマップします。

name 文字列。
ステップの ID。 使用できる値: [-_A-Za-z0-9]*。

timeoutInMinutes 文字列。
このタスクが完了するまで待機してから、サーバーによって強制終了されるまでの時間を指定します。

パイプラインは、ジョブ レベルのタイムアウトで構成できます。 ステップが完了する前にジョブ レベルのタイムアウト間隔が経過すると、ステップが長い timeoutInMinutes 間隔で構成されている場合でも、実行中のジョブ (ステップを含む) が終了します。 詳細については、「タイムアウト」を参照してください。

retryCountOnTaskFailure 文字列。
タスクが失敗した場合の再試行回数。

注釈

pwsh キーワードは、そのタスクの pwsh 値が true に設定されている場合に PowerShell タスクショートカットです。 このタスクは、Windows、macOS、Linux 上の PowerShell Core でスクリプトを実行します。

条件のタイムアウトの詳細については、を参照してください。

各 PowerShell セッションは、実行されるジョブの期間中のみ継続します。 ブートストラップされた内容に依存するタスクは、ブートストラップと同じジョブ内にある必要があります。

例示

steps:
- pwsh: Write-Host Hello $($env:name)
  displayName: Say hello
  name: firstStep
  workingDirectory: $(build.sourcesDirectory)
  failOnStderr: true
  env:
    name: Microsoft

こちらもご覧ください