Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
d0150c8
Skip Changelog processing for data track (#12787)
JimSuplizio Jul 2, 2020
405219c
ClassCastExceptionForTopQueryWithAggregate (#12633)
xinlian12 Jul 2, 2020
c39454c
Adding namespace and missing exists methods (#12780)
conniey Jul 3, 2020
f27af36
Update README.md (#12756)
justbert Jul 3, 2020
7685539
Not let our sample down if property 'azure.activedirectory.tenant-id'…
Jul 3, 2020
31029c5
Servicebus track2 readme changes 10327 (#12735)
hemanttanwar Jul 3, 2020
22ce2f8
Servicebus track2 live test receive renew lock (#12737)
hemanttanwar Jul 3, 2020
78ed9ef
disable flaky assert (#12793)
weidongxu-microsoft Jul 3, 2020
486c321
fix bug of auto configuration of spring boot starters (#12795)
yiliuTo Jul 3, 2020
e2e242c
mgmt regen resources (#12794)
weidongxu-microsoft Jul 3, 2020
6410184
mgmt fix todo (#12798)
weidongxu-microsoft Jul 6, 2020
0ba3641
Mgmt: Appplatform (#12350)
ChenTanyi Jul 6, 2020
02155b4
[Event Hubs] Consolidate all javadoc codesnippet Java files into a si…
srnagar Jul 6, 2020
60cde34
FormRecognizer Receipt design update (#12380)
samvaity Jul 6, 2020
2fc46dc
Sync eng/common directory with azure-sdk-tools repository (#12738)
azure-sdk Jul 6, 2020
714c26b
Removing bridge API for reactor. (#12827)
hemanttanwar Jul 6, 2020
b730543
Fix single upload retry. (#12834)
kasobol-msft Jul 6, 2020
3d49736
Fixes bug in buffered upload where data would be uploaded incorrectly…
gapra-msft Jul 7, 2020
d8afe9c
mgmt, add url to pom description (#12844)
weidongxu-microsoft Jul 7, 2020
467c9e7
update link in AUTH.md (#12845)
xseeseesee Jul 7, 2020
da149bb
mgmt resources fix TODOs (#12814)
xseeseesee Jul 7, 2020
00e5096
Cache refresh for container recreate with same id (#12747)
xinlian12 Jul 7, 2020
1961116
Migrate integration tests for spring-data-cosmosdb (#12609)
yiliuTo Jul 7, 2020
86afb16
Testing for Tables Autorest Code (#12512)
eboyd23 Jul 7, 2020
927fa43
Update Search APIs Based on Review (#12791)
alzimmermsft Jul 7, 2020
5a6bd8c
Enable blocking operation in batch receive (#12822)
srnagar Jul 7, 2020
9e4911b
update versions. (#12872)
g2vinay Jul 7, 2020
e59b888
Prepping 73 release (#12873)
gapra-msft Jul 7, 2020
aa1e607
Added versions and added REST docs (#12874)
gapra-msft Jul 7, 2020
c548afc
change RNTBD defaults as per learning and to be in par with .Net (#12…
moderakh Jul 7, 2020
c4e54cd
Nio read attr (#12621)
rickle-msft Jul 7, 2020
afe7b59
July patch release preparation for AppConfig, TA and FR (#12833)
mssfang Jul 7, 2020
5dfe115
Sync eng/common directory with azure-sdk-tools repository (#12870)
azure-sdk Jul 7, 2020
9009f12
Add plugin to internal avro to add empty javadoc (#12879)
gapra-msft Jul 8, 2020
34e9894
Add missing changelogs (#12876)
chidozieononiwu Jul 8, 2020
6aea90f
SpotBugs step to use the Maven proxy. (#12889)
mitchdenny Jul 8, 2020
f5fcfa2
Increment package version after release of com.azure azure-ai-textana…
azure-sdk Jul 8, 2020
f8c7aae
Increment version for storage releases (#12877)
azure-sdk Jul 8, 2020
3221338
Remove ServiceBusMessageProcessor (#12885)
conniey Jul 8, 2020
dc84cf7
Increment package version after release of com.azure azure-data-appco…
azure-sdk Jul 8, 2020
67ab775
open to azure-core, for f.setAccessible(true); in FlatteningSerialize…
weidongxu-microsoft Jul 8, 2020
d59bd7c
move AzureServiceClient to fluentcore (#12908)
weidongxu-microsoft Jul 8, 2020
ff484b6
Add Javadoc Escapes to README Overview (#12627)
alzimmermsft Jul 8, 2020
04bf47f
Increment version for formrecognizer release (#12916)
samvaity Jul 8, 2020
3df5560
Ignored flaky CF tests (#12915)
gapra-msft Jul 8, 2020
2a3e40b
Renamed azure-spring-data-cosmosdb to azure-spring-data-cosmos (#12881)
kushagraThapar Jul 8, 2020
9a509bd
Sync eng/common directory with azure-sdk-tools repository (#12912)
azure-sdk Jul 8, 2020
c4b3c17
Update versions for EH July release (#12913)
srnagar Jul 8, 2020
2f4f39f
Added script logging enabled API to CosmosStoredProcedureRequestOptio…
kushagraThapar Jul 8, 2020
2c6eb8a
Creating yml file for ctl image build ci (#12926)
simplynaveen20 Jul 8, 2020
7a9d5f5
Revert storabge blob version in version_client.txt (#12928)
srnagar Jul 8, 2020
a1800e5
Increment version for eventhubs releases (#12927)
azure-sdk Jul 8, 2020
1007365
Use proper variable syntax (#12930)
danieljurek Jul 8, 2020
f29f725
Increment package version after release of com.azure azure-core
azure-sdk Jul 8, 2020
e896387
Tweaking the Java Cosmos CTL pipeline yml (#12933)
JimSuplizio Jul 9, 2020
46e87cf
add CONTRIBUTING.MD for azure-spring-boot (#12901)
yiliuTo Jul 9, 2020
08bba18
Increment azure core version to 1.7.0-beta.2 (#12958)
jianghaolu Jul 9, 2020
5399396
Close message processor downstream. (#12921)
conniey Jul 9, 2020
d2719b2
Clean up repository resources (#12892)
chidozieononiwu Jul 9, 2020
23b3517
Sync eng/common directory with azure-sdk-tools repository (#12938)
azure-sdk Jul 9, 2020
9bdecc5
mgmt support api version detection (#12907)
xseeseesee Jul 9, 2020
0526b69
Create Migration Guide from Track 1 to Track 2 (#12909)
nickzhums Jul 9, 2020
9361802
add key vault certificate permission (#12965)
ChenTanyi Jul 9, 2020
7d211b4
PR for EH + serializer integration (#12205)
arerlend Jul 9, 2020
e7be51b
Increment version for core releases (#12969)
azure-sdk Jul 9, 2020
037e12d
Add workaround for Checkstyle error, closes #6216 (#6593)
karianna Jul 9, 2020
be3d197
Revert "PR for EH + serializer integration (#12205)" (#12976)
arerlend Jul 9, 2020
8705591
Fix the issue of ChangeFeedProcessorCodeSnippet (#12894)
Melanie-Ma Jul 9, 2020
feaf5d4
Updated azure spring data cosmos group id and artifact id (#12925)
kushagraThapar Jul 9, 2020
9861529
Added an exception to unsupported provider methods instead of no-op'i…
rickle-msft Jul 9, 2020
4bb00ef
Update ctl-image-build.yml (#12973)
simplynaveen20 Jul 9, 2020
32f2037
Remove search model builder classes (#12796)
srnagar Jul 10, 2020
a08a57b
Add some wagon options. (#12991)
mitchdenny Jul 10, 2020
e0772d4
Added idle tcp connection timeout bug where gateway connection overri…
kushagraThapar Jul 10, 2020
f627f82
Use Varargs in Model APIs (#12878)
alzimmermsft Jul 10, 2020
734b8cd
Spring - Remove Intermediate Poms (#12966)
saragluna Jul 10, 2020
eadf80d
Updates prefetch algorithm and test updates. (#12975)
conniey Jul 10, 2020
078e4e0
Add beta_tag to 1.7.0-beta.1 azure core
jianghaolu Jul 10, 2020
9a89e2a
Merge branch 'master' of github.com:Azure/azure-sdk-for-java into inc…
jianghaolu Jul 10, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
/sdk/core/ @alzimmermsft @jianghaolu @srnagar @hemanttanwar @anuchandy
/sdk/core/azure-core-tracing-opentelemetry/ @samvaity @alzimmermsft
/sdk/cosmos/ @moderakh @kushagraThapar @David-Noble-at-work @kirankumarkolli @mbhaskar
/sdk/cosmos/azure-spring-data-cosmosdb/ @kushagraThapar
/sdk/cosmos/azure-spring-data-cosmos/ @kushagraThapar @saragluna @yiliuTo @chenrujun @zhoufenqin @jialindai
/sdk/eventhubs/ @conniey @srnagar @mssfang
/sdk/formrecognizer/ @samvaity @mssfang @sima-zhu
/sdk/identity/ @schaabs @g2vinay @jianghaolu
Expand All @@ -27,7 +27,7 @@
/sdk/servicebus/ @yvgopal @nemakam @hemanttanwar @conniey
/sdk/storage/ @amishra-dev @rickle-msft @jaschrep-msft @gapra-msft @alzimmermsft @sima-zhu
/sdk/textanalytics/ @samvaity @mssfang @sima-zhu
/sdk/spring/ @saragluna @yiliuTo @chenrujun @jialindai
/sdk/spring/ @saragluna @yiliuTo @chenrujun @zhoufenqin @jialindai

# end to end tests
/sdk/e2e/ @jianghaolu @g2vinay
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,4 @@ package-lock.json
# VS Code
.vscode/
.factorypath
jacoco.exec
16 changes: 16 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,22 @@ Some live tests may have additional steps for setting up live testing resources.
See the CONTRIBUTING.md file for the service you wish to test for additional
information or instructions.

### Workaround for Checkstyle error

When building locally you might run into a Checkstyle such as the following:

```
Execution default of goal org.apache.maven.plugins:maven-checkstyle-plugin:3.1.0:check failed:
Plugin org.apache.maven.plugins:maven-checkstyle-plugin:3.1.0 or one of its dependencies could not be resolved:
Could not find artifact com.azure:sdk-build-tools:jar:1.0.0 in ossrh (https://oss.sonatype.org/content/repositories/snapshots/)
```

This is because the `sdk-build-tools` project isn't released to Maven. To resolve this issue you'll need to copy the `eng` folder locally then install `sdk-build-tools`.

`mvn clean install eng/code-quality-reports/pom.xml`

All code in the Azure SDKs for Java repository must pass Checkstyle before being merged. The `sdk-build-tools` is updated periodically, so if a new branch fails Checkstyle you'll need to reinstall.

## Versions and versioning

Tooling has been introduced to centralize versioning and help ease the pain of updating artifact versions in POM and README files. Under the eng\versioning directory there exists version text files, one for client ([version_client.txt](./eng/versioning/version_client.txt)) and one for data ([version_data.txt](./eng/versioning/version_data.txt)). The format of the version files is as follows:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,8 @@
<suppress checks="LineLength" files="com.azure.ai.formrecognizer.implementation.models"/>
<suppress checks="LineLength" files="com.azure.ai.formrecognizer.Transforms.java"/>

<suppress checks="GoodLoggingCheck" files="com.azure.ai.formrecognizer.models.FieldValueType.java" />

<!-- TODO: Fix with https://github.com/Azure/azure-sdk-for-java/issues#6716 Method name should follow a common vocabulary. -->
<suppress checks="com.azure.tools.checkstyle.checks.ServiceClientCheck" files=".*[/\\]textanalytics[/\\].*"/>

Expand Down Expand Up @@ -472,9 +474,9 @@
<suppress checks="AvoidNestedBlocks" files="com.azure.storage.internal.avro.implementation.schema.AvroSchema.java"/>
<suppress checks="AvoidNestedBlocks" files="com.azure.storage.internal.avro.implementation.schema.AvroType.java"/>
<suppress checks="com.azure.tools.checkstyle.checks.EnforceFinalFieldsCheck"
files="com.microsoft.azure.spring.data.cosmosdb.config.AbstractCosmosConfiguration.java"/>
files="com.azure.spring.data.cosmos.config.AbstractCosmosConfiguration.java"/>
<suppress checks="com.azure.tools.checkstyle.checks.EnforceFinalFieldsCheck"
files="com.microsoft.azure.spring.data.cosmosdb.core.query.CosmosPageRequest.java"/>
files="com.azure.spring.data.cosmos.core.query.CosmosPageRequest.java"/>

<!-- Checkstyle suppressions for azure-test-watch package -->
<suppress checks="com.azure.tools.checkstyle.checks.ExternalDependencyExposedCheck" files="com.azure.testing.AzureTestWatcher.java"/>
Expand All @@ -483,9 +485,9 @@
<!-- Checkstyle suppressions for resource manager package -->
<suppress checks="com.azure.tools.checkstyle.checks.ServiceClientCheck" files="com.azure.resourcemanager.*"/>

<!-- Checkstyle suppressions for spring-data-cosmosdb package -->
<suppress checks="com.azure.tools.checkstyle.checks.GoodLoggingCheck|ExternalDependencyExposedCheck|ThrowFromClientLoggerCheck" files="com.microsoft.azure.spring.data.cosmosdb.*\.java"/>
<suppress checks="MethodName|MemberName|ParameterName|VisibilityModifier" files="com.microsoft.azure.spring.data.cosmosdb.domain|repository|config.*\.java"/>
<suppress checks="ConstantName" files="com.microsoft.azure.spring.data.cosmosdb.repository|common.*\.java" />
<!-- Checkstyle suppressions for azure-spring-data-cosmos package -->
<suppress checks="com.azure.tools.checkstyle.checks.GoodLoggingCheck|ExternalDependencyExposedCheck|ThrowFromClientLoggerCheck" files="com.azure.spring.data.cosmos.*\.java"/>
<suppress checks="MethodName|MemberName|ParameterName|VisibilityModifier" files="com.azure.spring.data.cosmos.domain|repository|config.*\.java"/>
<suppress checks="ConstantName" files="com.azure.spring.data.cosmos.repository|common.*\.java" />

</suppressions>
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
"com\\.microsoft\\.spring\\..+",
"javax\\.jms(\\..+)?",
"javax\\.servlet(\\..+)?",
"io\\.micrometer(\\..+)?"
"io\\.micrometer(\\..+)?",
"com\\.azure\\.data\\.cosmos(\\..+)?",
"com\\.azure\\.spring\\.data\\.cosmos\\..+"
]
}
}
Expand Down
36 changes: 19 additions & 17 deletions eng/common/Update-Change-Log.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ function Get-ChangelogPath($Path)
{
# Check if CHANGELOG.md is present in path
$ChangeLogPath = Join-Path -Path $Path -ChildPath "CHANGELOG.md"
if ((Test-Path -Path $ChangeLogPath) -eq $False){
if ((Test-Path -Path $ChangeLogPath) -eq $False) {
# Check if change log exists with name HISTORY.md
$ChangeLogPath = Join-Path -Path $Path -ChildPath "HISTORY.md"
if ((Test-Path -Path $ChangeLogPath) -eq $False){
if ((Test-Path -Path $ChangeLogPath) -eq $False) {
Write-Host "Change log is not found in path[$Path]"
exit(1)
}
Expand All @@ -45,7 +45,7 @@ function Get-VersionTitle($Version, $Unreleased)
{
# Generate version title
$newVersionTitle = "## $Version $UNRELEASED_TAG"
if ($Unreleased -eq $False){
if ($Unreleased -eq $False) {
$releaseDate = Get-Date -Format "(yyyy-MM-dd)"
$newVersionTitle = "## $Version $releaseDate"
}
Expand All @@ -67,10 +67,10 @@ function Get-NewChangeLog( [System.Collections.ArrayList]$ChangelogLines, $Versi
# Version increment tool passes replaceversion as False and Unreleased as True
$is_version_increment = $ReplaceVersion -eq $False -and $Unreleased -eq $True

for(; $Index -lt $ChangelogLines.Count; $Index++){
if (Version-Matches($ChangelogLines[$Index])){
for (; $Index -lt $ChangelogLines.Count; $Index++) {
if (Version-Matches($ChangelogLines[$Index])) {
# Find current title in change log
if( -not $CurrentTitle){
if( -not $CurrentTitle) {
$CurrentTitle = $ChangelogLines[$Index]
$CurrentIndex = $Index
Write-Host "Current Version title: $CurrentTitle"
Expand All @@ -80,7 +80,7 @@ function Get-NewChangeLog( [System.Collections.ArrayList]$ChangelogLines, $Versi
# update change log script is triggered for all packages with current version for Java ( or any language where version is maintained in common file)
# and this can cause an issue if someone changes changelog manually to prepare for release without updating actual version in central version file
# Do not add new line or replace existing title when version is already present and script is triggered to add new line
if ($is_version_increment -and $ChangelogLines[$Index].Contains($Version)){
if ($is_version_increment -and $ChangelogLines[$Index].Contains($Version)) {
Write-Host "Version is already present in change log."
exit(0)
}
Expand All @@ -90,26 +90,24 @@ function Get-NewChangeLog( [System.Collections.ArrayList]$ChangelogLines, $Versi
# Generate version title
$newVersionTitle = Get-VersionTitle -Version $Version -Unreleased $Unreleased

if( $newVersionTitle -eq $CurrentTitle){
if( $newVersionTitle -eq $CurrentTitle) {
Write-Host "No change is required in change log. Version is already present."
exit(0)
}



if (($ReplaceVersion -eq $True) -and ($Unreleased -eq $False) -and (-not $CurrentTitle.Contains($UNRELEASED_TAG))){
if (($ReplaceVersion -eq $True) -and ($Unreleased -eq $False) -and $CurrentTitle.Contains($version) -and (-not $CurrentTitle.Contains($UNRELEASED_TAG))) {
Write-Host "Version is already present in change log with a release date."
exit(0)
}

# if current version title already has new version then we should replace title to update it
if ($CurrentTitle.Contains($Version) -and $ReplaceVersion -eq $False){
if ($CurrentTitle.Contains($Version) -and $ReplaceVersion -eq $False) {
Write-Host "Version is already present in title. Updating version title"
$ReplaceVersion = $True
}

# if version is already found and not replacing then nothing to do
if ($ReplaceVersion -eq $False){
if ($ReplaceVersion -eq $False) {
Write-Host "Adding version title $newVersionTitle"
$ChangelogLines.insert($CurrentIndex, "")
$ChangelogLines.insert($CurrentIndex, "")
Expand All @@ -121,24 +119,28 @@ function Get-NewChangeLog( [System.Collections.ArrayList]$ChangelogLines, $Versi
$ChangelogLines[$CurrentIndex] = $newVersionTitle
}

return $ChangelogLines
return $ChangelogLines
}


# Make sure path is valid
if ((Test-Path -Path $ChangeLogPath) -eq $False){
if ((Test-Path -Path $ChangeLogPath) -eq $False) {
Write-Host "Change log path is invalid. [$ChangeLogPath]"
exit(1)
}

# probe change log path if path is directory
if (Test-Path -Path $ChangeLogPath -PathType Container)
{
if (Test-Path -Path $ChangeLogPath -PathType Container) {
$ChangeLogPath = Get-ChangelogPath -Path $ChangeLogPath
}

# Read current change logs and add/update version
$ChangelogLines = [System.Collections.ArrayList](Get-Content -Path $ChangeLogPath)

if ($null -eq $ChangelogLines) {
$ChangelogLines = @()
}

$NewContents = Get-NewChangeLog -ChangelogLines $ChangelogLines -Version $Version -Unreleased $Unreleased -ReplaceVersion $ReplaceVersion

Write-Host "Writing change log to file [$ChangeLogPath]"
Expand Down
12 changes: 12 additions & 0 deletions eng/common/pipelines/templates/steps/daily-dev-build-variable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# This script fragment is used across our repos to set a variable "SetDevVersion" which
# is used when this pipeline is going to be generating and publishing daily dev builds.

steps:
- pwsh: |
$setDailyDevBuild = "false"
if (('$(Build.Reason)' -eq 'Schedule') -and ('$(System.TeamProject)' -eq 'internal')) {
$setDailyDevBuild = "true"
}
echo "##vso[task.setvariable variable=SetDevVersion]$setDailyDevBuild"
displayName: "Setup Versioning Properties"
condition: eq(variables['SetDevVersion'], '')
2 changes: 1 addition & 1 deletion eng/common/pipelines/templates/steps/verify-changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ steps:
-ForRelease $${{ parameters.ForRelease }}
pwsh: true
workingDirectory: $(Pipeline.Workspace)
displayName: Verify ChangeLog / Release Notes
displayName: Verify ChangeLogEntry for ${{ parameters.PackageName }}
continueOnError: false
28 changes: 18 additions & 10 deletions eng/common/scripts/Verify-ChangeLog.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,29 @@ param (
[boolean]$ForRelease=$False
)

$ProgressPreference = "SilentlyContinue"
. (Join-Path $PSScriptRoot SemVer.ps1)
Import-Module (Join-Path $PSScriptRoot modules ChangeLog-Operations.psm1)

if ((Test-Path $ChangeLogLocation) -and -not([System.String]::IsNullOrEmpty($VersionString)))
$validChangeLog = $false
if ($ChangeLogLocation -and $VersionString)
{
Confirm-ChangeLogEntry -ChangeLogLocation $ChangeLogLocation -VersionString $VersionString -ForRelease $ForRelease
$validChangeLog = Confirm-ChangeLogEntry -ChangeLogLocation $ChangeLogLocation -VersionString $VersionString -ForRelease $ForRelease
}
else
{
Import-Module (Join-Path $PSScriptRoot modules Package-Properties.psm1)
if ([System.String]::IsNullOrEmpty($Language))
{
$Language = $RepoName.Substring($RepoName.LastIndexOf('-') + 1)
}
Import-Module (Join-Path $PSScriptRoot modules Package-Properties.psm1)
if ([System.String]::IsNullOrEmpty($Language))
{
$Language = $RepoName.Substring($RepoName.LastIndexOf('-') + 1)
}

$PackageProp = Get-PkgProperties -PackageName $PackageName -ServiceName $ServiceName -Language $Language -RepoRoot $RepoRoot
Confirm-ChangeLogEntry -ChangeLogLocation $PackageProp.pkgChangeLogPath -VersionString $PackageProp.pkgVersion -ForRelease $ForRelease
}
$PackageProp = Get-PkgProperties -PackageName $PackageName -ServiceName $ServiceName -Language $Language -RepoRoot $RepoRoot
$validChangeLog = Confirm-ChangeLogEntry -ChangeLogLocation $PackageProp.pkgChangeLogPath -VersionString $PackageProp.pkgVersion -ForRelease $ForRelease
}

if (!$validChangeLog) {
exit 1
}

exit 0
1 change: 0 additions & 1 deletion eng/common/scripts/create-tags-and-git-release.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ param (
# used by VerifyPackages
$artifactLocation, # the root of the artifact folder. DevOps $(System.ArtifactsDirectory)
$workingDirectory, # directory that package artifacts will be extracted into for examination (if necessary)
[ValidateSet("Nuget","NPM","PyPI","Maven")]
$packageRepository, # used to indicate destination against which we will check the existing version.
# valid options: PyPI, Nuget, NPM, Maven, C
# used by CreateTags
Expand Down
54 changes: 32 additions & 22 deletions eng/common/scripts/modules/ChangeLog-Operations.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ function Get-ChangeLogEntries {

$changeLogEntries = @{}
if (!(Test-Path $ChangeLogLocation)) {
Write-Host "ChangeLog '{0}' was not found" -f $ChangeLogLocation
exit 1
Write-Error "ChangeLog[${ChangeLogLocation}] does not exist"
return $null
}

try {
Expand Down Expand Up @@ -51,14 +51,12 @@ function Get-ChangeLogEntry {
[Parameter(Mandatory = $true)]
[String]$VersionString
)

$changeLogEntries = Get-ChangeLogEntries -ChangeLogLocation $ChangeLogLocation

if ($changeLogEntries.ContainsKey($VersionString)) {
if ($changeLogEntries -and $changeLogEntries.ContainsKey($VersionString)) {
return $changeLogEntries[$VersionString]
}
Write-Error "Release Notes for the Specified version ${VersionString} was not found"
exit 1
return $null
}

#Returns the changelog for a particular version as string
Expand All @@ -70,9 +68,16 @@ function Get-ChangeLogEntryAsString {
[String]$VersionString
)

$changeLogEntries = Get-ChangeLogEntry -ChangeLogLocation $ChangeLogLocation -VersionString $VersionString
[string]$releaseTitle = $changeLogEntries.ReleaseTitle
[string]$releaseContent = $changeLogEntries.ReleaseContent -Join [Environment]::NewLine
$changeLogEntry = Get-ChangeLogEntry -ChangeLogLocation $ChangeLogLocation -VersionString $VersionString
return ChangeLogEntryAsString $changeLogEntry
}

function ChangeLogEntryAsString($changeLogEntry) {
if (!$changeLogEntry) {
return "[Missing change log entry]"
}
[string]$releaseTitle = $changeLogEntry.ReleaseTitle
[string]$releaseContent = $changeLogEntry.ReleaseContent -Join [Environment]::NewLine
return $releaseTitle, $releaseContent -Join [Environment]::NewLine
}

Expand All @@ -87,28 +92,33 @@ function Confirm-ChangeLogEntry {

$changeLogEntry = Get-ChangeLogEntry -ChangeLogLocation $ChangeLogLocation -VersionString $VersionString

if (!$changeLogEntry) {
Write-Error "ChangeLog[${ChangeLogLocation}] does not have an entry for version ${VersionString}."
return $false
}

Write-Host "Found the following change log entry for version '${VersionString}' in [${ChangeLogLocation}]."
Write-Host "-----"
Write-Host (ChangeLogEntryAsString $changeLogEntry)
Write-Host "-----"

if ([System.String]::IsNullOrEmpty($changeLogEntry.ReleaseStatus)) {
Write-Host ("##[error]Changelog '{0}' has wrong release note title" -f $ChangeLogLocation)
Write-Host "##[info]Ensure the release date is included i.e. (yyyy-MM-dd) or (Unreleased) if not yet released"
exit 1
Write-Error "Entry does not have a correct release status. Please ensure the status is set to a date '(yyyy-MM-dd)' or '(Unreleased)' if not yet released."
return $false
}

if ($ForRelease -eq $True) {
$CurrentDate = Get-Date -Format "yyyy-MM-dd"
if ($changeLogEntry.ReleaseStatus -ne "($CurrentDate)") {
Write-Host ("##[warning]Incorrect Date: Please use the current date in the Changelog '{0}' before releasing the package" -f $ChangeLogLocation)
exit 1
if ($changeLogEntry.ReleaseStatus -eq "(Unreleased)") {
Write-Error "Entry has no release date set. Please ensure to set a release date with format 'yyyy-MM-dd'."
return $false
}

if ([System.String]::IsNullOrWhiteSpace($changeLogEntry.ReleaseContent)) {
Write-Host ("##[error]Empty Release Notes for '{0}' in '{1}'" -f $VersionString, $ChangeLogLocation)
Write-Host "##[info]Please ensure there is a release notes entry before releasing the package."
exit 1
Write-Error "Entry has no content. Please ensure to provide some content of what changed in this version."
return $false
}
}

Write-Host $changeLogEntry.ReleaseTitle
Write-Host $changeLogEntry.ReleaseContent
return $true
}

Export-ModuleMember -Function 'Get-ChangeLogEntries'
Expand Down
Loading