From 282db39b3ec8c44bd3e5c39b32f76db83678862e Mon Sep 17 00:00:00 2001 From: Chidozie Ononiwu Date: Fri, 26 Mar 2021 13:25:07 -0700 Subject: [PATCH 1/7] Make RELEASE_TITLE_REGEX more specific --- eng/common/scripts/ChangeLog-Operations.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/common/scripts/ChangeLog-Operations.ps1 b/eng/common/scripts/ChangeLog-Operations.ps1 index 0f02790ce4..73fd80a63f 100644 --- a/eng/common/scripts/ChangeLog-Operations.ps1 +++ b/eng/common/scripts/ChangeLog-Operations.ps1 @@ -2,7 +2,7 @@ . "${PSScriptRoot}\logging.ps1" . "${PSScriptRoot}\SemVer.ps1" -$RELEASE_TITLE_REGEX = "(?^\#+.*(?\b\d+\.\d+\.\d+([^0-9\s][^\s:]+)?)(\s+(?\(.*\)))?)" +$RELEASE_TITLE_REGEX = "(?^\##\s+(?\b\d+\.\d+\.\d+([^0-9\s][^\s:]+)?)(\s+(?\(.*\)))?)" $CHANGELOG_UNRELEASED_STATUS = "(Unreleased)" $CHANGELOG_DATE_FORMAT = "yyyy-MM-dd" From a4b22eade1eac7d8f17422a55f62f898ff71cfa5 Mon Sep 17 00:00:00 2001 From: Chidozie Ononiwu <31145988+chidozieononiwu@users.noreply.github.com> Date: Tue, 30 Mar 2021 14:20:40 -0700 Subject: [PATCH 2/7] Update eng/common/scripts/ChangeLog-Operations.ps1 Co-authored-by: Wes Haggard --- eng/common/scripts/ChangeLog-Operations.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/common/scripts/ChangeLog-Operations.ps1 b/eng/common/scripts/ChangeLog-Operations.ps1 index 73fd80a63f..f7ac153442 100644 --- a/eng/common/scripts/ChangeLog-Operations.ps1 +++ b/eng/common/scripts/ChangeLog-Operations.ps1 @@ -2,7 +2,7 @@ . "${PSScriptRoot}\logging.ps1" . "${PSScriptRoot}\SemVer.ps1" -$RELEASE_TITLE_REGEX = "(?^\##\s+(?\b\d+\.\d+\.\d+([^0-9\s][^\s:]+)?)(\s+(?\(.*\)))?)" +$RELEASE_TITLE_REGEX = "(?^\#+\s+$([AzureEngSemanticVersion]::SEMVER_REGEX))(\s+(?\(.*\))))" $CHANGELOG_UNRELEASED_STATUS = "(Unreleased)" $CHANGELOG_DATE_FORMAT = "yyyy-MM-dd" @@ -212,4 +212,4 @@ function Set-ChangeLogContent { } Set-Content -Path $ChangeLogLocation -Value $changeLogContent -} \ No newline at end of file +} From 5721ade3bd7e7001cc925e416cfa9edaeacfd846 Mon Sep 17 00:00:00 2001 From: Chidozie Ononiwu Date: Fri, 23 Apr 2021 15:53:41 -0700 Subject: [PATCH 3/7] Update release REGEX --- eng/common/scripts/ChangeLog-Operations.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/common/scripts/ChangeLog-Operations.ps1 b/eng/common/scripts/ChangeLog-Operations.ps1 index f7ac153442..92f948dfd6 100644 --- a/eng/common/scripts/ChangeLog-Operations.ps1 +++ b/eng/common/scripts/ChangeLog-Operations.ps1 @@ -2,7 +2,7 @@ . "${PSScriptRoot}\logging.ps1" . "${PSScriptRoot}\SemVer.ps1" -$RELEASE_TITLE_REGEX = "(?^\#+\s+$([AzureEngSemanticVersion]::SEMVER_REGEX))(\s+(?\(.*\))))" +$RELEASE_TITLE_REGEX = "(?^\#+\s+(?$([AzureEngSemanticVersion]::SEMVER_REGEX))(\s+(?\(.+\))))" $CHANGELOG_UNRELEASED_STATUS = "(Unreleased)" $CHANGELOG_DATE_FORMAT = "yyyy-MM-dd" From 5a3a2b547955379e1c4652d40dc02d49b84e833b Mon Sep 17 00:00:00 2001 From: Chidozie Ononiwu Date: Tue, 27 Apr 2021 21:12:15 -0700 Subject: [PATCH 4/7] tighten up changelog verification --- eng/common/scripts/ChangeLog-Operations.ps1 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/eng/common/scripts/ChangeLog-Operations.ps1 b/eng/common/scripts/ChangeLog-Operations.ps1 index 92f948dfd6..3a533cceb5 100644 --- a/eng/common/scripts/ChangeLog-Operations.ps1 +++ b/eng/common/scripts/ChangeLog-Operations.ps1 @@ -120,7 +120,11 @@ function Confirm-ChangeLogEntry { else { $status = $changeLogEntry.ReleaseStatus.Trim().Trim("()") try { - [DateTime]$status + $releaseDate = [DateTime]$status + if (((Get-Date).AddDays(-31) -gt $releaseDate) -or ($releaseDate -gt (Get-Date).AddDays(31))) + { + throw "Date is way outside of the current release period." + } } catch { LogError "Invalid date [ $status ] passed as status for Version [$($changeLogEntry.ReleaseVersion)]." From 328844d3c88e7c13d244b758975016bb733543c7 Mon Sep 17 00:00:00 2001 From: Chidozie Ononiwu Date: Wed, 28 Apr 2021 13:54:57 -0700 Subject: [PATCH 5/7] Ensure releaseDate is in the appriopriate format. --- eng/common/scripts/ChangeLog-Operations.ps1 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/eng/common/scripts/ChangeLog-Operations.ps1 b/eng/common/scripts/ChangeLog-Operations.ps1 index 3a533cceb5..2d8ab77a41 100644 --- a/eng/common/scripts/ChangeLog-Operations.ps1 +++ b/eng/common/scripts/ChangeLog-Operations.ps1 @@ -121,6 +121,10 @@ function Confirm-ChangeLogEntry { $status = $changeLogEntry.ReleaseStatus.Trim().Trim("()") try { $releaseDate = [DateTime]$status + if ($status -ne ($releaseDate.ToString($CHANGELOG_DATE_FORMAT))) + { + throw "Date must be in the format $($CHANGELOG_DATE_FORMAT)" + } if (((Get-Date).AddDays(-31) -gt $releaseDate) -or ($releaseDate -gt (Get-Date).AddDays(31))) { throw "Date is way outside of the current release period." From 680545eb3f722de8956f3033e192bc488a1bf5f6 Mon Sep 17 00:00:00 2001 From: Chidozie Ononiwu Date: Wed, 28 Apr 2021 18:34:13 -0700 Subject: [PATCH 6/7] Update error messages. --- eng/common/scripts/ChangeLog-Operations.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/common/scripts/ChangeLog-Operations.ps1 b/eng/common/scripts/ChangeLog-Operations.ps1 index 2d8ab77a41..b18e4f52ef 100644 --- a/eng/common/scripts/ChangeLog-Operations.ps1 +++ b/eng/common/scripts/ChangeLog-Operations.ps1 @@ -123,11 +123,11 @@ function Confirm-ChangeLogEntry { $releaseDate = [DateTime]$status if ($status -ne ($releaseDate.ToString($CHANGELOG_DATE_FORMAT))) { - throw "Date must be in the format $($CHANGELOG_DATE_FORMAT)" + LogError "Date must be in the format $($CHANGELOG_DATE_FORMAT)" } - if (((Get-Date).AddDays(-31) -gt $releaseDate) -or ($releaseDate -gt (Get-Date).AddDays(31))) + if (((Get-Date).AddMonths(-1) -gt $releaseDate) -or ($releaseDate -gt (Get-Date).AddMonths(1))) { - throw "Date is way outside of the current release period." + LogError "The date must be within +/- one month from today." } } catch { From 755840d387174623a520fe80bd9b0e478a9a049e Mon Sep 17 00:00:00 2001 From: Chidozie Ononiwu Date: Thu, 29 Apr 2021 13:58:57 -0700 Subject: [PATCH 7/7] Retrun false after error --- eng/common/scripts/ChangeLog-Operations.ps1 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/eng/common/scripts/ChangeLog-Operations.ps1 b/eng/common/scripts/ChangeLog-Operations.ps1 index b18e4f52ef..8547791afc 100644 --- a/eng/common/scripts/ChangeLog-Operations.ps1 +++ b/eng/common/scripts/ChangeLog-Operations.ps1 @@ -124,10 +124,12 @@ function Confirm-ChangeLogEntry { if ($status -ne ($releaseDate.ToString($CHANGELOG_DATE_FORMAT))) { LogError "Date must be in the format $($CHANGELOG_DATE_FORMAT)" + return $false } if (((Get-Date).AddMonths(-1) -gt $releaseDate) -or ($releaseDate -gt (Get-Date).AddMonths(1))) { LogError "The date must be within +/- one month from today." + return $false } } catch {