-
Notifications
You must be signed in to change notification settings - Fork 256
Feature/change log tools improvement #1153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
4 commits merged into
Azure:master
from
chidozieononiwu:feature/ChangeLogToolsImprovement
Nov 13, 2020
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
fda22cc
Improve Update-ChangeLog Logic
chidozieononiwu bbcc4b9
Updates to ChangeLog-Operations.ps1, copy-docs-to-blobstorage.ps1, In…
chidozieononiwu 582ea7b
More changeLog Logic Improvements
chidozieononiwu 2fb7985
Update date parsing
chidozieononiwu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,119 @@ | ||
| # Note: This script will add or replace version title in change log | ||
|
chidozieononiwu marked this conversation as resolved.
|
||
|
|
||
| # Parameter description | ||
| # Version : Version to add or replace in change log | ||
| # Unreleased: Default is true. If it is set to false, then today's date will be set in verion title. If it is True then title will show "Unreleased" | ||
| # ReplaceLatestEntry: Replaces the latest changelog entry, including its content. | ||
|
|
||
| param ( | ||
| [Parameter(Mandatory = $true)] | ||
| [String]$Version, | ||
| [Parameter(Mandatory = $true)] | ||
| [String]$ServiceDirectory, | ||
| [Parameter(Mandatory = $true)] | ||
| [String]$PackageName, | ||
| [boolean]$Unreleased=$True, | ||
| [boolean]$ReplaceLatestEntry = $False, | ||
| [String]$ReleaseDate | ||
| ) | ||
|
|
||
| if ($ReleaseDate -and ($Unreleased -eq $True)) { | ||
| LogError "Do not pass 'ReleaseDate' arguement when 'Unreleased' is true" | ||
| exit 1 | ||
| } | ||
|
|
||
| . "${PSScriptRoot}\common.ps1" | ||
|
|
||
| if ($ReleaseDate) | ||
| { | ||
| try { | ||
| $ReleaseStatus = ([DateTime]$ReleaseDate).ToString($CHANGELOG_DATE_FORMAT) | ||
| $ReleaseStatus = "($ReleaseStatus)" | ||
| } | ||
| catch { | ||
| LogError "Invalid 'ReleaseDate'. Please use a valid date in the format '$CHANGELOG_DATE_FORMAT'" | ||
| exit 1 | ||
| } | ||
| } | ||
| elseif ($Unreleased) { | ||
| $ReleaseStatus = $CHANGELOG_UNRELEASED_STATUS | ||
| } | ||
| else { | ||
| $ReleaseStatus = "$(Get-Date -Format $CHANGELOG_DATE_FORMAT)" | ||
| $ReleaseStatus = "($ReleaseStatus)" | ||
| } | ||
|
|
||
| if ($null -eq [AzureEngSemanticVersion]::ParseVersionString($Version)) | ||
| { | ||
| LogError "Version [$Version] is invalid. Please use a valid SemVer" | ||
| exit(0) | ||
| } | ||
|
|
||
| $PkgProperties = Get-PkgProperties -PackageName $PackageName -ServiceDirectory $ServiceDirectory | ||
| $ChangeLogEntries = Get-ChangeLogEntries -ChangeLogLocation $PkgProperties.ChangeLogPath | ||
|
|
||
|
|
||
| if ($ChangeLogEntries.Contains($Version)) | ||
| { | ||
| if ($ChangeLogEntries[$Version].ReleaseStatus -eq $ReleaseStatus) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. At some point we should set the indention level to 2 spaces like the other ps files. |
||
| { | ||
| LogWarning "Version is already present in change log with specificed ReleaseStatus [$ReleaseStatus]" | ||
| exit(0) | ||
| } | ||
|
|
||
| if ($Unreleased -and ($ChangeLogEntries[$Version].ReleaseStatus -ne $ReleaseStatus)) | ||
| { | ||
| LogWarning "Version is already present in change log with a release date. Please review [$($PkgProperties.ChangeLogPath)]" | ||
| exit(0) | ||
| } | ||
|
|
||
| if (!$Unreleased -and ($ChangeLogEntries[$Version].ReleaseStatus -ne $CHANGELOG_UNRELEASED_STATUS)) | ||
| { | ||
| if ((Get-Date ($ChangeLogEntries[$Version].ReleaseStatus).Trim("()")) -gt (Get-Date $ReleaseStatus.Trim("()"))) | ||
| { | ||
| LogWarning "New ReleaseDate for version [$Version] is older than existing release date in changelog. Please review [$($PkgProperties.ChangeLogPath)]" | ||
| exit(0) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| $PresentVersionsSorted = [AzureEngSemanticVersion]::SortVersionStrings($ChangeLogEntries.Keys) | ||
| $LatestVersion = $PresentVersionsSorted[0] | ||
|
|
||
| $LatestsSorted = [AzureEngSemanticVersion]::SortVersionStrings(@($LatestVersion, $Version)) | ||
| if ($LatestsSorted[0] -ne $Version) { | ||
| LogWarning "Passed Version [$Version] is older than the latestversion [$LatestVersion] in the changelog. Please use a more recent version." | ||
| exit(0) | ||
| } | ||
|
|
||
| if ($ReplaceLatestEntry) | ||
| { | ||
| $ChangeLogEntries.Remove($LatestVersion) | ||
| $newChangeLogEntry = New-ChangeLogEntry -Version $Version -Status $ReleaseStatus | ||
| if ($newChangeLogEntry) { | ||
| $ChangeLogEntries[$Version] = $newChangeLogEntry | ||
| } | ||
| else { | ||
| LogError "Failed to create new changelog entry" | ||
| } | ||
| } | ||
| elseif ($ChangeLogEntries.Contains($Version)) | ||
| { | ||
| $ChangeLogEntries[$Version].ReleaseVersion = $Version | ||
| $ChangeLogEntries[$Version].ReleaseStatus = $ReleaseStatus | ||
| $ChangeLogEntries[$Version].ReleaseTitle = "## $Version $ReleaseStatus" | ||
| } | ||
| else | ||
| { | ||
| $newChangeLogEntry = New-ChangeLogEntry -Version $Version -Status $ReleaseStatus | ||
| if ($newChangeLogEntry) { | ||
| $ChangeLogEntries[$Version] = $newChangeLogEntry | ||
| } | ||
| else { | ||
| LogError "Failed to create new changelog entry" | ||
| } | ||
| } | ||
|
|
||
| Set-ChangeLogContent -ChangeLogLocation $PkgProperties.ChangeLogPath -ChangeLogEntries $ChangeLogEntries | ||
|
|
||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.