1

VSTS リリース パイプラインで、powershell スクリプトへのファイル パスを使用してロールバック タスクを使用しています。スクリプトはタスクのステータスを読み取り、ロールバック アクションを実行します。しかし、リリースパイプラインで実行中にエラーが発生しました。

2016-06-07T14:40:29.3618995Z ##[デバッグ]実行のための個人アクセス トークンの取得

2016-06-07T14:40:42.1723249Z ##[デバッグ] https://aced.vsrm.visualstudio.com/HON.ACS.PIM.DAM.FWD/_apis/release/releases/158/environments/158/を呼び出すtasks?api-version=2.1-preview.1取得した PAT トークンを使用

2016-06-07T14:40:42.6644892Z ##[デバッグ] リリース タスクのステータスを取得できませんでした

2016-06-07T14:40:42.6675181Z ##[デバッグ] リモート サーバーがエラーを返しました: (500) 内部サーバー エラー。

2016-06-07T14:40:42.6714886Z ##[デバッグ] クエリのリリースに失敗しました。

2016-06-07T14:40:42.6905170Z ##[debug]タスク実行履歴を{}として取得

使用したスクリプトを以下に示します。

try
{
    $jsonobject = ConvertFrom-Json $env:Release_Tasks
}
catch
{
    Write-Verbose -Verbose "Error converting from json"
    Write-Verbose -Verbose $Error
}

foreach ($task in $jsonobject | Get-Member -MemberType NoteProperty)
{    
    $taskproperty = $jsonobject.$($task.Name) | ConvertFrom-Json
    Write-Verbose -Verbose "Task $($taskproperty.Name) with rank $($task.Name) has status $($taskproperty.Status)"
    Write-Verbose -Verbose "$($taskproperty.Name)"
    if($taskproperty.Name -eq "Execute Web deploy command" -and $taskproperty.Status -eq  "failure")
    {
        $statuscode = "$($taskproperty.Status)"
        Write-Host $statuscode
        #Setting up the environment variable for package install status
        Write-Output "Web Deploy Status Code is: $statuscode"
        Write-Host ("##vso[task.setvariable variable=statusWebDeploy;]$statuscode")
        Write-Verbose -Verbose "statusWebDeploy:" $env:statusWebDeploy "Initiating Restore Website Folder..."
    }
}

インライン スクリプトとファイル パス アプローチの両方を試しましたが、うまくいきませんでした。助けてください。

4

1 に答える 1

0

タスクのステータスを提供する API で必要な API バージョンに変更があります。タスク スクリプトを API の最新バージョンに更新します。VSTS フォーラムの Q&A は、こちらを参照してください。

于 2016-12-08T12:40:04.410 に答える