Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 33 additions & 10 deletions eng/common/scripts/ChangeLog-Operations.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ function Confirm-ChangeLogEntry {
[PSCustomObject]$ChangeLogStatus = $null
)

$suppressErrors = $false
if (!$ChangeLogStatus) {
$ChangeLogStatus = [PSCustomObject]@{
IsValid = $false
Expand All @@ -150,15 +151,17 @@ 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]

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
}

Expand All @@ -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
}

Expand Down Expand Up @@ -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("()")
Expand All @@ -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
Expand All @@ -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
}
2 changes: 1 addition & 1 deletion eng/common/scripts/Create-APIReview.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down