Skip to content

Commit 9839988

Browse files
Update logic to compare agains actual date build was queued
1 parent 856ce13 commit 9839988

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

eng/common/pipelines/templates/steps/verify-changelog.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ steps:
1919
-RepoRoot $(Build.SourcesDirectory)
2020
-RepoName $(Build.Repository.Name)
2121
-ForRelease $${{ parameters.ForRelease }}
22+
-BuildNumber $(Build.BuildNumber)
2223
pwsh: true
2324
workingDirectory: $(Pipeline.Workspace)
2425
displayName: Verify ChangeLogEntry for ${{ parameters.PackageName }}

eng/common/scripts/Verify-ChangeLog.ps1

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ param (
88
[ValidateSet("net","java","js","python")]
99
[string]$Language,
1010
[string]$RepoName,
11-
[boolean]$ForRelease=$False
11+
[boolean]$ForRelease=$False,
12+
[string]$BuildNumber
1213
)
1314

1415
. (Join-Path $PSScriptRoot SemVer.ps1)
@@ -27,5 +28,5 @@ else
2728
}
2829

2930
$PackageProp = Get-PkgProperties -PackageName $PackageName -ServiceName $ServiceName -Language $Language -RepoRoot $RepoRoot
30-
Confirm-ChangeLogEntry -ChangeLogLocation $PackageProp.pkgChangeLogPath -VersionString $PackageProp.pkgVersion -ForRelease $ForRelease
31+
Confirm-ChangeLogEntry -ChangeLogLocation $PackageProp.pkgChangeLogPath -VersionString $PackageProp.pkgVersion -ForRelease $ForRelease -BuildNo $BuildNumber
3132
}

eng/common/scripts/modules/ChangeLog-Operations.psm1

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ function Confirm-ChangeLogEntry {
8282
[String]$ChangeLogLocation,
8383
[Parameter(Mandatory = $true)]
8484
[String]$VersionString,
85-
[boolean]$ForRelease = $false
85+
[boolean]$ForRelease = $false,
86+
[string]$BuildNo
8687
)
8788

8889
$changeLogEntry = Get-ChangeLogEntry -ChangeLogLocation $ChangeLogLocation -VersionString $VersionString
@@ -94,8 +95,8 @@ function Confirm-ChangeLogEntry {
9495
}
9596

9697
if ($ForRelease -eq $True) {
97-
$CurrentDate = Get-Date -Format "yyyy-MM-dd"
98-
if ($changeLogEntry.ReleaseStatus -ne "($CurrentDate)") {
98+
$ExpectedStatus = '(' + $BuildNo.Substring(0,4) + '-' + $BuildNo.Substring(4,2) + '-' + $BuildNo.Substring(6,2) + ')'
99+
if ($changeLogEntry.ReleaseStatus -ne $ExpectedStatus) {
99100
Write-Host ("##[warning]Incorrect Date: Please use the current date in the Changelog '{0}' before releasing the package" -f $ChangeLogLocation)
100101
exit 1
101102
}

0 commit comments

Comments
 (0)