Sync eng/common directory with azure-sdk-tools for PR 7989 (#5480)

* Remove soft errors in validation step from Devops pipeline
This commit is contained in:
Azure SDK Bot 2024-04-02 16:08:31 -04:00 коммит произвёл GitHub
Родитель 6450530bd8
Коммит 88c6e1dc0c
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
2 изменённых файлов: 34 добавлений и 11 удалений

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

@ -142,6 +142,7 @@ function Confirm-ChangeLogEntry {
[PSCustomObject]$ChangeLogStatus = $null
)
$suppressErrors = $false
if (!$ChangeLogStatus) {
$ChangeLogStatus = [PSCustomObject]@{
IsValid = $false
@ -150,7 +151,7 @@ function Confirm-ChangeLogEntry {
}
else {
# Do not stop the script on error when status object is passed as param
$ErrorActionPreference = 'Continue'
$suppressErrors = $true
}
$changeLogEntries = Get-ChangeLogEntries -ChangeLogLocation $ChangeLogLocation
$changeLogEntry = $changeLogEntries[$VersionString]
@ -158,7 +159,9 @@ function Confirm-ChangeLogEntry {
if (!$changeLogEntry) {
$ChangeLogStatus.Message = "ChangeLog[${ChangeLogLocation}] does not have an entry for version ${VersionString}."
$ChangeLogStatus.IsValid = $false
LogError "$($ChangeLogStatus.Message)"
if (!$suppressErrors) {
LogError "$($ChangeLogStatus.Message)"
}
return $false
}
@ -176,7 +179,9 @@ function Confirm-ChangeLogEntry {
if ([System.String]::IsNullOrEmpty($changeLogEntry.ReleaseStatus)) {
$ChangeLogStatus.Message = "Entry does not have a release status. Please ensure the status is set to a date '($CHANGELOG_DATE_FORMAT)' or '$CHANGELOG_UNRELEASED_STATUS' if not yet released. See https://aka.ms/azsdk/guideline/changelogs for more info."
$ChangeLogStatus.IsValid = $false
LogError "$($ChangeLogStatus.Message)"
if (!$suppressErrors) {
LogError "$($ChangeLogStatus.Message)"
}
return $false
}
@ -359,19 +364,25 @@ function Confirm-ChangeLogForRelease {
$ChangeLogStatus = $null
)
$suppressErrors = $false
if (!$ChangeLogStatus) {
$ChangeLogStatus = [PSCustomObject]@{
IsValid = $false
Message = ""
}
}
else {
$suppressErrors = $true
}
$entries = Sort-ChangeLogEntries -changeLogEntries $changeLogEntries
$ChangeLogStatus.IsValid = $true
if ($changeLogEntry.ReleaseStatus -eq $CHANGELOG_UNRELEASED_STATUS) {
$ChangeLogStatus.Message = "Entry has no release date set. Please ensure to set a release date with format '$CHANGELOG_DATE_FORMAT'. See https://aka.ms/azsdk/guideline/changelogs for more info."
$ChangeLogStatus.IsValid = $false
LogError "$($ChangeLogStatus.Message)"
if (!$suppressErrors) {
LogError "$($ChangeLogStatus.Message)"
}
}
else {
$status = $changeLogEntry.ReleaseStatus.Trim().Trim("()")
@ -381,27 +392,35 @@ function Confirm-ChangeLogForRelease {
{
$ChangeLogStatus.Message = "Date must be in the format $($CHANGELOG_DATE_FORMAT). See https://aka.ms/azsdk/guideline/changelogs for more info."
$ChangeLogStatus.IsValid = $false
LogError "$($ChangeLogStatus.Message)"
if (!$suppressErrors) {
LogError "$($ChangeLogStatus.Message)"
}
}
if (@($entries.ReleaseStatus)[0] -ne $changeLogEntry.ReleaseStatus)
{
$ChangeLogStatus.Message = "Invalid date [ $status ]. The date for the changelog being released must be the latest in the file."
$ChangeLogStatus.IsValid = $false
LogError "$($ChangeLogStatus.Message)"
if (!$suppressErrors) {
LogError "$($ChangeLogStatus.Message)"
}
}
}
catch {
$ChangeLogStatus.Message = "Invalid date [ $status ] passed as status for Version [$($changeLogEntry.ReleaseVersion)]. See https://aka.ms/azsdk/guideline/changelogs for more info."
$ChangeLogStatus.IsValid = $false
LogError "$($ChangeLogStatus.Message)"
if (!$suppressErrors) {
LogError "$($ChangeLogStatus.Message)"
}
}
}
if ([System.String]::IsNullOrWhiteSpace($changeLogEntry.ReleaseContent)) {
$ChangeLogStatus.Message = "Entry has no content. Please ensure to provide some content of what changed in this version. See https://aka.ms/azsdk/guideline/changelogs for more info."
$ChangeLogStatus.IsValid = $false
LogError "$($ChangeLogStatus.Message)"
if (!$suppressErrors) {
LogError "$($ChangeLogStatus.Message)"
}
}
$foundRecommendedSection = $false
@ -422,12 +441,16 @@ function Confirm-ChangeLogForRelease {
{
$ChangeLogStatus.Message = "The changelog entry has the following sections with no content ($($emptySections -join ', ')). Please ensure to either remove the empty sections or add content to the section."
$ChangeLogStatus.IsValid = $false
LogError "$($ChangeLogStatus.Message)"
if (!$suppressErrors) {
LogError "$($ChangeLogStatus.Message)"
}
}
if (!$foundRecommendedSection)
{
$ChangeLogStatus.Message = "The changelog entry did not contain any of the recommended sections ($($RecommendedSectionHeaders -join ', ')), please add at least one. See https://aka.ms/azsdk/guideline/changelogs for more info."
LogWarning "$($ChangeLogStatus.Message)"
if (!$suppressErrors) {
LogError "$($ChangeLogStatus.Message)"
}
}
return $ChangeLogStatus.IsValid
}

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

@ -149,7 +149,7 @@ function Submit-APIReview($packageInfo, $packagePath, $packageArtifactName)
$reviewTokenFileName = Get-APITokenFileName $packageArtifactName
if ($reviewTokenFileName) {
Write-Host "Uploading review token file $reviewTokenFileName to APIView."
return Upload-ReviewTokenFile $packageName $apiLabel $packageInfo.ReleaseStatus $reviewTokenFileName $packageInfo.Version $packagePath
return Upload-ReviewTokenFile $packageArtifactName $apiLabel $packageInfo.ReleaseStatus $reviewTokenFileName $packageInfo.Version $packagePath
}
else {
Write-Host "Uploading $packagePath to APIView."