Merge pull request #121 from microsoft/users/tianw/refreshtoken

Refresh token when polling and fix input errors with flight
This commit is contained in:
Louis Wu 2024-11-04 09:41:04 -08:00 коммит произвёл GitHub
Родитель f5d2b2cb9d 423cc0e7f7
Коммит ccfea23af3
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
3 изменённых файлов: 28 добавлений и 8 удалений

Просмотреть файл

@ -285,14 +285,34 @@ try
{
Write-Output "Polling for submission $submissionId to finish"
# Refresh AccessToken before polling to avoid token expiration
$commonParams['AccessToken'] = (Get-AzureRMAccessToken $endPointObj $endpointId $resource).access_token
if (-not $(Watch-ExistingSubmission @commonParams -SubmissionId $submissionId -TargetPublishMode $targetPublishMode))
$shouldMonitor = $true
while ($shouldMonitor)
{
throw $("The submission $submissionId didn't reach the publishing state.$([Environment]::NewLine)" + `
"Verify issues in dev center: https://partner.microsoft.com/en-us/dashboard/products/$appId/submissions/$submissionId")
try
{
# Refresh AccessToken before polling
$commonParams['AccessToken'] = (Get-AzureRMAccessToken $endPointObj $endpointId $resource).access_token
if (-not $(Watch-ExistingSubmission @commonParams -SubmissionId $submissionId -TargetPublishMode $targetPublishMode))
{
throw $("The submission $submissionId didn't reach the publishing state.$([Environment]::NewLine)" + `
"Verify issues in dev center: https://partner.microsoft.com/en-us/dashboard/products/$appId/submissions/$submissionId")
}
Write-Output "Submission $submissionId completed"
$shouldMonitor = $false
}
catch
{
# Catch any authorization related exception and retry polling by refreshing the access token
if ($_.Exception.Message -ilike "*Unauthorized*")
{
Write-Output "Got exception with authentication while trying to check on submission. Will try again. The exception was:" -Exception $_ -Level Warning
}
else {
throw $_
}
}
}
Write-Output "Submission $submissionId completed"
Write-VstsSetResult -Result "Succeeded" -Message "Submission $submissionId completed"
}
}

Просмотреть файл

@ -16,7 +16,7 @@
"version": {
"Major": "3",
"Minor": "0",
"Patch": "25"
"Patch": "27"
},
"minimumAgentVersion": "2.117.0",
"instanceNameFormat": "Publish $(appName)",

Просмотреть файл

@ -1,7 +1,7 @@
{
"manifestVersion": 1,
"id": "windows-store-publish",
"version": "2.4.33",
"version": "2.4.36",
"name": "Windows Store",
"publisher": "ms-rdx-mro",
"description": "Publish your applications on the Windows Store.",