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
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'], '')
27 changes: 17 additions & 10 deletions eng/common/scripts/Verify-ChangeLog.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,25 @@ $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
51 changes: 31 additions & 20 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,27 +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) {
if ($changeLogEntry.ReleaseStatus -eq "(Unreleased)") {
Write-Host ("##[error]No release date set. Please set a release date with format 'yyyy-MM-dd' in the heading for version '{0}' in the changelog '{1}'." -f $VersionString, $ChangelogLocation)
exit 1
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
36 changes: 28 additions & 8 deletions eng/common/scripts/modules/Package-Properties.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,32 @@
class PackageProps
{
[string]$pkgName
[AzureEngSemanticVersion]$pkgVersion
[string]$pkgVersion
[string]$pkgDirectoryPath
[string]$pkgServiceName
[string]$pkgReadMePath
[string]$pkgChangeLogPath
[string]$pkgGroup

PackageProps(
PackageProps([string]$pkgName,[string]$pkgVersion,[string]$pkgDirectoryPath,[string]$pkgServiceName)
{
$this.Initialize($pkgName, $pkgVersion, $pkgDirectoryPath, $pkgServiceName)
}

PackageProps([string]$pkgName,[string]$pkgVersion,[string]$pkgDirectoryPath,[string]$pkgServiceName,[string]$pkgGroup="")
{
$this.Initialize($pkgName, $pkgVersion, $pkgDirectoryPath, $pkgServiceName, $pkgGroup)
}

hidden [void]Initialize(
[string]$pkgName,
[string]$pkgVersion,
[string]$pkgDirectoryPath,
[string]$pkgServiceName
)
{
$this.pkgName = $pkgName
$this.pkgVersion = [AzureEngSemanticVersion]::ParseVersionString($pkgVersion)
if ($this.pkgVersion -eq $null)
{
Write-Error "Invalid version in $pkgDirectoryPath"
}
$this.pkgVersion = $pkgVersion
$this.pkgDirectoryPath = $pkgDirectoryPath
$this.pkgServiceName = $pkgServiceName

Expand All @@ -43,6 +50,18 @@ class PackageProps
$this.pkgChangeLogPath = $null
}
}

hidden [void]Initialize(
[string]$pkgName,
[string]$pkgVersion,
[string]$pkgDirectoryPath,
[string]$pkgServiceName,
[string]$pkgGroup
)
{
$this.Initialize($pkgName, $pkgVersion, $pkgDirectoryPath, $pkgServiceName)
$this.pkgGroup = $pkgGroup
}
}

$ProgressPreference = "SilentlyContinue"
Expand Down Expand Up @@ -127,10 +146,11 @@ function Extract-JavaPkgProps ($pkgPath, $serviceName, $pkgName)
$projectData.load($projectPath)
$projectPkgName = $projectData.project.artifactId
$pkgVersion = $projectData.project.version
$pkgGroup = $projectData.project.groupId

if ($projectPkgName -eq $pkgName)
{
return [PackageProps]::new($pkgName, $pkgVersion.ToString(), $pkgPath, $serviceName)
return [PackageProps]::new($pkgName, $pkgVersion.ToString(), $pkgPath, $serviceName, $pkgGroup)
}
}
return $null
Expand Down