Compare commits
10 Commits
a2082c3e5b
...
705832762f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
705832762f | ||
|
|
a3c8483cdb | ||
|
|
e699d11db0 | ||
|
|
1dc34d1633 | ||
|
|
13d95d3a46 | ||
|
|
e10992a7d4 | ||
|
|
5f2ab2f337 | ||
|
|
8ba2425b96 | ||
|
|
621e2a905c | ||
|
|
6b28105085 |
@ -215,16 +215,17 @@ function FindParentWorkItem($serviceName, $packageDisplayName, $outputCommand =
|
|||||||
$packageWorkItems = @{}
|
$packageWorkItems = @{}
|
||||||
$packageWorkItemWithoutKeyFields = @{}
|
$packageWorkItemWithoutKeyFields = @{}
|
||||||
|
|
||||||
function FindLatestPackageWorkItem($lang, $packageName, $outputCommand = $true, $ignoreReleasePlannerTests = $true, $tag = $null)
|
function FindLatestPackageWorkItem($lang, $packageName, $groupId = $null, $outputCommand = $true, $ignoreReleasePlannerTests = $true, $tag = $null)
|
||||||
{
|
{
|
||||||
# Cache all the versions of this package and language work items
|
# Cache all the versions of this package and language work items
|
||||||
$null = FindPackageWorkItem $lang $packageName -includeClosed $true -outputCommand $outputCommand -ignoreReleasePlannerTests $ignoreReleasePlannerTests -tag $tag
|
$null = FindPackageWorkItem $lang $packageName -includeClosed $true -outputCommand $outputCommand -ignoreReleasePlannerTests $ignoreReleasePlannerTests -tag $tag -groupId $groupId
|
||||||
|
|
||||||
$latestWI = $null
|
$latestWI = $null
|
||||||
foreach ($wi in $packageWorkItems.Values)
|
foreach ($wi in $packageWorkItems.Values)
|
||||||
{
|
{
|
||||||
if ($wi.fields["Custom.Language"] -ne $lang) { continue }
|
if ($wi.fields["Custom.Language"] -ne $lang) { continue }
|
||||||
if ($wi.fields["Custom.Package"] -ne $packageName) { continue }
|
if ($wi.fields["Custom.Package"] -ne $packageName) { continue }
|
||||||
|
if ($groupId -and $wi.fields["Custom.GroupId"] -ne $groupId) { continue }
|
||||||
|
|
||||||
if (!$latestWI) {
|
if (!$latestWI) {
|
||||||
$latestWI = $wi
|
$latestWI = $wi
|
||||||
@ -238,9 +239,9 @@ function FindLatestPackageWorkItem($lang, $packageName, $outputCommand = $true,
|
|||||||
return $latestWI
|
return $latestWI
|
||||||
}
|
}
|
||||||
|
|
||||||
function FindPackageWorkItem($lang, $packageName, $version, $outputCommand = $true, $includeClosed = $false, $ignoreReleasePlannerTests = $true, $tag = $null)
|
function FindPackageWorkItem($lang, $packageName, $version, $groupId = $null, $outputCommand = $true, $includeClosed = $false, $ignoreReleasePlannerTests = $true, $tag = $null)
|
||||||
{
|
{
|
||||||
$key = BuildHashKeyNoNull $lang $packageName $version
|
$key = BuildHashKey $lang $packageName $version $groupId
|
||||||
if ($key -and $packageWorkItems.ContainsKey($key)) {
|
if ($key -and $packageWorkItems.ContainsKey($key)) {
|
||||||
return $packageWorkItems[$key]
|
return $packageWorkItems[$key]
|
||||||
}
|
}
|
||||||
@ -253,6 +254,7 @@ function FindPackageWorkItem($lang, $packageName, $version, $outputCommand = $tr
|
|||||||
$fields += "System.Tags"
|
$fields += "System.Tags"
|
||||||
$fields += "Custom.Language"
|
$fields += "Custom.Language"
|
||||||
$fields += "Custom.Package"
|
$fields += "Custom.Package"
|
||||||
|
$fields += "Custom.GroupId"
|
||||||
$fields += "Custom.PackageDisplayName"
|
$fields += "Custom.PackageDisplayName"
|
||||||
$fields += "System.Title"
|
$fields += "System.Title"
|
||||||
$fields += "Custom.PackageType"
|
$fields += "Custom.PackageType"
|
||||||
@ -282,6 +284,9 @@ function FindPackageWorkItem($lang, $packageName, $version, $outputCommand = $tr
|
|||||||
if ($packageName) {
|
if ($packageName) {
|
||||||
$query += " AND [Package] = '${packageName}'"
|
$query += " AND [Package] = '${packageName}'"
|
||||||
}
|
}
|
||||||
|
if ($groupId) {
|
||||||
|
$query += " AND [GroupId] = '${groupId}'"
|
||||||
|
}
|
||||||
if ($version) {
|
if ($version) {
|
||||||
$query += " AND [PackageVersionMajorMinor] = '${version}'"
|
$query += " AND [PackageVersionMajorMinor] = '${version}'"
|
||||||
}
|
}
|
||||||
@ -295,7 +300,7 @@ function FindPackageWorkItem($lang, $packageName, $version, $outputCommand = $tr
|
|||||||
|
|
||||||
foreach ($wi in $workItems)
|
foreach ($wi in $workItems)
|
||||||
{
|
{
|
||||||
$localKey = BuildHashKeyNoNull $wi.fields["Custom.Language"] $wi.fields["Custom.Package"] $wi.fields["Custom.PackageVersionMajorMinor"]
|
$localKey = BuildHashKey $wi.fields["Custom.Language"] $wi.fields["Custom.Package"] $wi.fields["Custom.PackageVersionMajorMinor"] $wi.fields["Custom.GroupId"]
|
||||||
if (!$localKey) {
|
if (!$localKey) {
|
||||||
$packageWorkItemWithoutKeyFields[$wi.id] = $wi
|
$packageWorkItemWithoutKeyFields[$wi.id] = $wi
|
||||||
Write-Host "Skipping package [$($wi.id)]$($wi.fields['System.Title']) which is missing required fields language, package, or version."
|
Write-Host "Skipping package [$($wi.id)]$($wi.fields['System.Title']) which is missing required fields language, package, or version."
|
||||||
@ -461,10 +466,10 @@ function UpdatePackageWorkItemReleaseState($id, $state, $releaseType, $outputCom
|
|||||||
|
|
||||||
function FindOrCreateClonePackageWorkItem($lang, $pkg, $verMajorMinor, $allowPrompt = $false, $outputCommand = $false, $relatedId = $null, $tag= $null, $ignoreReleasePlannerTests = $true)
|
function FindOrCreateClonePackageWorkItem($lang, $pkg, $verMajorMinor, $allowPrompt = $false, $outputCommand = $false, $relatedId = $null, $tag= $null, $ignoreReleasePlannerTests = $true)
|
||||||
{
|
{
|
||||||
$workItem = FindPackageWorkItem -lang $lang -packageName $pkg.Package -version $verMajorMinor -includeClosed $true -outputCommand $outputCommand -tag $tag -ignoreReleasePlannerTests $ignoreReleasePlannerTests
|
$workItem = FindPackageWorkItem -lang $lang -packageName $pkg.Package -version $verMajorMinor -includeClosed $true -outputCommand $outputCommand -tag $tag -ignoreReleasePlannerTests $ignoreReleasePlannerTests -groupId $pkg.GroupId
|
||||||
|
|
||||||
if (!$workItem) {
|
if (!$workItem) {
|
||||||
$latestVersionItem = FindLatestPackageWorkItem -lang $lang -packageName $pkg.Package -outputCommand $outputCommand -tag $tag -ignoreReleasePlannerTests $ignoreReleasePlannerTests
|
$latestVersionItem = FindLatestPackageWorkItem -lang $lang -packageName $pkg.Package -outputCommand $outputCommand -tag $tag -ignoreReleasePlannerTests $ignoreReleasePlannerTests -groupId $pkg.GroupId
|
||||||
$assignedTo = "me"
|
$assignedTo = "me"
|
||||||
$extraFields = @()
|
$extraFields = @()
|
||||||
if ($latestVersionItem) {
|
if ($latestVersionItem) {
|
||||||
@ -512,6 +517,13 @@ function CreateOrUpdatePackageWorkItem($lang, $pkg, $verMajorMinor, $existingIte
|
|||||||
Write-Host "Cannot create or update because one of lang, pkg or verMajorMinor aren't set. [$lang|$($pkg.Package)|$verMajorMinor]"
|
Write-Host "Cannot create or update because one of lang, pkg or verMajorMinor aren't set. [$lang|$($pkg.Package)|$verMajorMinor]"
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# PackageProp object uses Group, while other places use GroupId, such as in work item fields and package csv files.
|
||||||
|
$pkgGroupId = if ($pkg.PSObject.Properties.Name -contains "GroupId") {
|
||||||
|
$pkg.GroupId
|
||||||
|
} else {
|
||||||
|
$null
|
||||||
|
}
|
||||||
$pkgName = $pkg.Package
|
$pkgName = $pkg.Package
|
||||||
$pkgDisplayName = $pkg.DisplayName
|
$pkgDisplayName = $pkg.DisplayName
|
||||||
$pkgType = $pkg.Type
|
$pkgType = $pkg.Type
|
||||||
@ -523,6 +535,7 @@ function CreateOrUpdatePackageWorkItem($lang, $pkg, $verMajorMinor, $existingIte
|
|||||||
$fields = @()
|
$fields = @()
|
||||||
$fields += "`"Language=${lang}`""
|
$fields += "`"Language=${lang}`""
|
||||||
$fields += "`"Package=${pkgName}`""
|
$fields += "`"Package=${pkgName}`""
|
||||||
|
$fields += "`"GroupId=${pkgGroupId}`""
|
||||||
$fields += "`"PackageDisplayName=${pkgDisplayName}`""
|
$fields += "`"PackageDisplayName=${pkgDisplayName}`""
|
||||||
$fields += "`"PackageType=${pkgType}`""
|
$fields += "`"PackageType=${pkgType}`""
|
||||||
$fields += "`"PackageTypeNewLibrary=${pkgNewLibrary}`""
|
$fields += "`"PackageTypeNewLibrary=${pkgNewLibrary}`""
|
||||||
@ -540,6 +553,7 @@ function CreateOrUpdatePackageWorkItem($lang, $pkg, $verMajorMinor, $existingIte
|
|||||||
|
|
||||||
if ($lang -ne $existingItem.fields["Custom.Language"]) { $changedField = "Custom.Language" }
|
if ($lang -ne $existingItem.fields["Custom.Language"]) { $changedField = "Custom.Language" }
|
||||||
if ($pkgName -ne $existingItem.fields["Custom.Package"]) { $changedField = "Custom.Package" }
|
if ($pkgName -ne $existingItem.fields["Custom.Package"]) { $changedField = "Custom.Package" }
|
||||||
|
if ($pkgGroupId -ne $existingItem.fields["Custom.GroupId"]) { $changedField = "Custom.GroupId" }
|
||||||
if ($verMajorMinor -ne $existingItem.fields["Custom.PackageVersionMajorMinor"]) { $changedField = "Custom.PackageVersionMajorMinor" }
|
if ($verMajorMinor -ne $existingItem.fields["Custom.PackageVersionMajorMinor"]) { $changedField = "Custom.PackageVersionMajorMinor" }
|
||||||
if ($pkgDisplayName -ne $existingItem.fields["Custom.PackageDisplayName"]) { $changedField = "Custom.PackageDisplayName" }
|
if ($pkgDisplayName -ne $existingItem.fields["Custom.PackageDisplayName"]) { $changedField = "Custom.PackageDisplayName" }
|
||||||
if ($pkgType -ne [string]$existingItem.fields["Custom.PackageType"]) { $changedField = "Custom.PackageType" }
|
if ($pkgType -ne [string]$existingItem.fields["Custom.PackageType"]) { $changedField = "Custom.PackageType" }
|
||||||
@ -1029,15 +1043,16 @@ function UpdatePackageVersions($pkgWorkItem, $plannedVersions, $shippedVersions)
|
|||||||
function UpdateValidationStatus($pkgvalidationDetails, $BuildDefinition, $PipelineUrl)
|
function UpdateValidationStatus($pkgvalidationDetails, $BuildDefinition, $PipelineUrl)
|
||||||
{
|
{
|
||||||
$pkgName = $pkgValidationDetails.Name
|
$pkgName = $pkgValidationDetails.Name
|
||||||
|
$groupId = $pkgValidationDetails.GroupId
|
||||||
$versionString = $pkgValidationDetails.Version
|
$versionString = $pkgValidationDetails.Version
|
||||||
|
|
||||||
$parsedNewVersion = [AzureEngSemanticVersion]::new($versionString)
|
$parsedNewVersion = [AzureEngSemanticVersion]::new($versionString)
|
||||||
$versionMajorMinor = "" + $parsedNewVersion.Major + "." + $parsedNewVersion.Minor
|
$versionMajorMinor = "" + $parsedNewVersion.Major + "." + $parsedNewVersion.Minor
|
||||||
$workItem = FindPackageWorkItem -lang $LanguageDisplayName -packageName $pkgName -version $versionMajorMinor -includeClosed $true -outputCommand $false
|
$workItem = FindPackageWorkItem -lang $LanguageDisplayName -packageName $pkgName -groupId $groupId -version $versionMajorMinor -includeClosed $true -outputCommand $false
|
||||||
|
|
||||||
if (!$workItem)
|
if (!$workItem)
|
||||||
{
|
{
|
||||||
Write-Host"No work item found for package [$pkgName]."
|
Write-Host "No work item found for package [$pkgName] with groupId [$groupId]."
|
||||||
return $false
|
return $false
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1250,6 +1265,7 @@ function Update-DevOpsReleaseWorkItem {
|
|||||||
[Parameter(Mandatory=$true)]
|
[Parameter(Mandatory=$true)]
|
||||||
[string]$version,
|
[string]$version,
|
||||||
[string]$plannedDate,
|
[string]$plannedDate,
|
||||||
|
[string]$groupId = $null,
|
||||||
[string]$serviceName = $null,
|
[string]$serviceName = $null,
|
||||||
[string]$packageDisplayName = $null,
|
[string]$packageDisplayName = $null,
|
||||||
[string]$packageRepoPath = "NA",
|
[string]$packageRepoPath = "NA",
|
||||||
@ -1277,6 +1293,7 @@ function Update-DevOpsReleaseWorkItem {
|
|||||||
|
|
||||||
$packageInfo = [PSCustomObject][ordered]@{
|
$packageInfo = [PSCustomObject][ordered]@{
|
||||||
Package = $packageName
|
Package = $packageName
|
||||||
|
GroupId = $groupId
|
||||||
DisplayName = $packageDisplayName
|
DisplayName = $packageDisplayName
|
||||||
ServiceName = $serviceName
|
ServiceName = $serviceName
|
||||||
RepoPath = $packageRepoPath
|
RepoPath = $packageRepoPath
|
||||||
|
|||||||
@ -230,16 +230,30 @@ class PackageProps {
|
|||||||
# Returns important properties of the package relative to the language repo
|
# Returns important properties of the package relative to the language repo
|
||||||
# Returns a PS Object with properties @ { pkgName, pkgVersion, pkgDirectoryPath, pkgReadMePath, pkgChangeLogPath }
|
# Returns a PS Object with properties @ { pkgName, pkgVersion, pkgDirectoryPath, pkgReadMePath, pkgChangeLogPath }
|
||||||
# Note: python is required for parsing python package properties.
|
# Note: python is required for parsing python package properties.
|
||||||
|
# GroupId is optional and is used to filter packages for languages that support group identifiers (e.g., Java).
|
||||||
|
# When GroupId is provided, the function will match both the package name and the group ID.
|
||||||
function Get-PkgProperties {
|
function Get-PkgProperties {
|
||||||
Param
|
Param
|
||||||
(
|
(
|
||||||
[Parameter(Mandatory = $true)]
|
[Parameter(Mandatory = $true)]
|
||||||
[string]$PackageName,
|
[string]$PackageName,
|
||||||
[string]$ServiceDirectory
|
[string]$ServiceDirectory,
|
||||||
|
[string]$GroupId
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Write-Host "Get-PkgProperties called with PackageName: [$PackageName], ServiceDirectory: [$ServiceDirectory], GroupId: [$GroupId]"
|
||||||
|
|
||||||
$allPkgProps = Get-AllPkgProperties -ServiceDirectory $ServiceDirectory
|
$allPkgProps = Get-AllPkgProperties -ServiceDirectory $ServiceDirectory
|
||||||
$pkgProps = $allPkgProps.Where({ $_.Name -eq $PackageName -or $_.ArtifactName -eq $PackageName });
|
|
||||||
|
if ([string]::IsNullOrEmpty($GroupId)) {
|
||||||
|
$pkgProps = $allPkgProps.Where({ $_.Name -eq $PackageName -or $_.ArtifactName -eq $PackageName });
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$pkgProps = $allPkgProps.Where({
|
||||||
|
($_.Name -eq $PackageName -or $_.ArtifactName -eq $PackageName) -and
|
||||||
|
($_.PSObject.Properties.Name -contains "Group" -and $_.Group -eq $GroupId)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if ($pkgProps.Count -ge 1) {
|
if ($pkgProps.Count -ge 1) {
|
||||||
if ($pkgProps.Count -gt 1) {
|
if ($pkgProps.Count -gt 1) {
|
||||||
@ -248,7 +262,12 @@ function Get-PkgProperties {
|
|||||||
return $pkgProps[0]
|
return $pkgProps[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
LogError "Failed to retrieve Properties for [$PackageName]"
|
if ([string]::IsNullOrEmpty($GroupId)) {
|
||||||
|
LogError "Failed to retrieve Properties for [$PackageName]"
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
LogError "Failed to retrieve Properties for [$PackageName] with GroupId [$GroupId]. Ensure the package has a Group property matching the specified GroupId."
|
||||||
|
}
|
||||||
return $null
|
return $null
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -568,3 +587,25 @@ function Get-PkgPropsForEntireService ($serviceDirectoryPath) {
|
|||||||
|
|
||||||
return $projectProps
|
return $projectProps
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Get the full package name based on packageInfo properties
|
||||||
|
# Returns Group+ArtifactName if Group exists and has a value, otherwise returns Name
|
||||||
|
# If UseColonSeparator switch is enabled, returns Group:ArtifactName format (colon separator)
|
||||||
|
function Get-FullPackageName {
|
||||||
|
param (
|
||||||
|
[Parameter(Mandatory=$true)]
|
||||||
|
[PSCustomObject]$PackageInfo,
|
||||||
|
[switch]$UseColonSeparator
|
||||||
|
)
|
||||||
|
|
||||||
|
if ($PackageInfo.PSObject.Members.Name -contains "Group") {
|
||||||
|
$groupId = $PackageInfo.Group
|
||||||
|
if ($groupId) {
|
||||||
|
if ($UseColonSeparator) {
|
||||||
|
return "${groupId}:$($PackageInfo.Name)"
|
||||||
|
}
|
||||||
|
return "${groupId}+$($PackageInfo.Name)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $PackageInfo.Name
|
||||||
|
}
|
||||||
|
|||||||
@ -30,6 +30,9 @@ If one isn't provided, then it will compute the next ship date or today's date i
|
|||||||
.PARAMETER ReleaseTrackingOnly
|
.PARAMETER ReleaseTrackingOnly
|
||||||
Optional: If this switch is passed then the script will only update the release work items and not update the versions in the local repo or validate the changelog.
|
Optional: If this switch is passed then the script will only update the release work items and not update the versions in the local repo or validate the changelog.
|
||||||
|
|
||||||
|
.PARAMETER GroupId
|
||||||
|
Optional: The group ID for the package. For Java packages, if not provided, the script will prompt for input with 'com.azure' as the default.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./eng/common/scripts/Prepare-Release.ps1 <PackageName>
|
PS> ./eng/common/scripts/Prepare-Release.ps1 <PackageName>
|
||||||
|
|
||||||
@ -49,7 +52,8 @@ param(
|
|||||||
[string]$PackageName,
|
[string]$PackageName,
|
||||||
[string]$ServiceDirectory,
|
[string]$ServiceDirectory,
|
||||||
[string]$ReleaseDate, # Pass Date in the form MM/dd/yyyy"
|
[string]$ReleaseDate, # Pass Date in the form MM/dd/yyyy"
|
||||||
[switch]$ReleaseTrackingOnly = $false
|
[switch]$ReleaseTrackingOnly = $false,
|
||||||
|
[string]$GroupId
|
||||||
)
|
)
|
||||||
Set-StrictMode -Version 3
|
Set-StrictMode -Version 3
|
||||||
|
|
||||||
@ -57,6 +61,18 @@ Set-StrictMode -Version 3
|
|||||||
. ${PSScriptRoot}\Helpers\ApiView-Helpers.ps1
|
. ${PSScriptRoot}\Helpers\ApiView-Helpers.ps1
|
||||||
. ${PSScriptRoot}\Helpers\DevOps-WorkItem-Helpers.ps1
|
. ${PSScriptRoot}\Helpers\DevOps-WorkItem-Helpers.ps1
|
||||||
|
|
||||||
|
# Prompt for GroupId if language is Java and GroupId is not provided
|
||||||
|
if ($Language -eq 'java' -and [string]::IsNullOrEmpty($GroupId)) {
|
||||||
|
$userInput = Read-Host "Input the group id, or press Enter to use 'com.azure' as the group id"
|
||||||
|
if ([string]::IsNullOrWhiteSpace($userInput)) {
|
||||||
|
$GroupId = "com.azure"
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$GroupId = $userInput.Trim()
|
||||||
|
}
|
||||||
|
Write-Host "Using GroupId: $GroupId" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
|
||||||
function Get-ReleaseDay($baseDate)
|
function Get-ReleaseDay($baseDate)
|
||||||
{
|
{
|
||||||
# Find first friday
|
# Find first friday
|
||||||
@ -74,7 +90,7 @@ function Get-ReleaseDay($baseDate)
|
|||||||
$ErrorPreference = 'Stop'
|
$ErrorPreference = 'Stop'
|
||||||
|
|
||||||
$packageProperties = $null
|
$packageProperties = $null
|
||||||
$packageProperties = Get-PkgProperties -PackageName $PackageName -ServiceDirectory $ServiceDirectory
|
$packageProperties = Get-PkgProperties -PackageName $PackageName -ServiceDirectory $ServiceDirectory -GroupId $GroupId
|
||||||
|
|
||||||
if (!$packageProperties)
|
if (!$packageProperties)
|
||||||
{
|
{
|
||||||
@ -128,7 +144,7 @@ if (Test-Path "Function:GetExistingPackageVersions")
|
|||||||
}
|
}
|
||||||
|
|
||||||
$currentProjectVersion = $packageProperties.Version
|
$currentProjectVersion = $packageProperties.Version
|
||||||
$newVersion = Read-Host -Prompt "Input the new version, or press Enter to use use current project version '$currentProjectVersion'"
|
$newVersion = Read-Host -Prompt "Input the new version, or press Enter to use current project version '$currentProjectVersion'"
|
||||||
|
|
||||||
if (!$newVersion)
|
if (!$newVersion)
|
||||||
{
|
{
|
||||||
@ -144,6 +160,7 @@ if ($null -eq $newVersionParsed)
|
|||||||
|
|
||||||
$result = Update-DevOpsReleaseWorkItem -language $LanguageDisplayName `
|
$result = Update-DevOpsReleaseWorkItem -language $LanguageDisplayName `
|
||||||
-packageName $packageProperties.Name `
|
-packageName $packageProperties.Name `
|
||||||
|
-groupId $packageProperties.Group `
|
||||||
-version $newVersion `
|
-version $newVersion `
|
||||||
-plannedDate $releaseDateString `
|
-plannedDate $releaseDateString `
|
||||||
-packageRepoPath $packageProperties.serviceDirectory `
|
-packageRepoPath $packageProperties.serviceDirectory `
|
||||||
@ -166,7 +183,8 @@ try
|
|||||||
}
|
}
|
||||||
$url = az keyvault secret show --name "APIURL" --vault-name "AzureSDKPrepRelease-KV" --query "value" --output "tsv"
|
$url = az keyvault secret show --name "APIURL" --vault-name "AzureSDKPrepRelease-KV" --query "value" --output "tsv"
|
||||||
$apiKey = az keyvault secret show --name "APIKEY" --vault-name "AzureSDKPrepRelease-KV" --query "value" --output "tsv"
|
$apiKey = az keyvault secret show --name "APIKEY" --vault-name "AzureSDKPrepRelease-KV" --query "value" --output "tsv"
|
||||||
Check-ApiReviewStatus -PackageName $packageProperties.Name -packageVersion $newVersion -Language $LanguageDisplayName -url $url -apiKey $apiKey
|
$fullPackageNameInApiView = Get-FullPackageName -PackageInfo $packageProperties -UseColonSeparator
|
||||||
|
Check-ApiReviewStatus -PackageName $fullPackageNameInApiView -packageVersion $newVersion -Language $LanguageDisplayName -url $url -apiKey $apiKey
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
@ -194,7 +212,7 @@ if (Test-Path "Function:SetPackageVersion")
|
|||||||
}
|
}
|
||||||
SetPackageVersion -PackageName $packageProperties.Name -Version $newVersion `
|
SetPackageVersion -PackageName $packageProperties.Name -Version $newVersion `
|
||||||
-ServiceDirectory $packageProperties.ServiceDirectory -ReleaseDate $releaseDateString `
|
-ServiceDirectory $packageProperties.ServiceDirectory -ReleaseDate $releaseDateString `
|
||||||
-PackageProperties $packageProperties -ReplaceLatestEntryTitle $replaceLatestEntryTitle
|
-PackageProperties $packageProperties -ReplaceLatestEntryTitle $replaceLatestEntryTitle -GroupId $packageProperties.Group
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
# Version : Version to add or replace in change log
|
# 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"
|
# 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"
|
||||||
# ReplaceLatestEntryTitle: Replaces the latest changelog entry title.
|
# ReplaceLatestEntryTitle: Replaces the latest changelog entry title.
|
||||||
|
# GroupId: Optional. The group ID for the package. Used for filtering packages in languages that support group identifiers (e.g., Java).
|
||||||
|
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
param (
|
param (
|
||||||
@ -14,7 +15,8 @@ param (
|
|||||||
[Boolean]$Unreleased = $true,
|
[Boolean]$Unreleased = $true,
|
||||||
[Boolean]$ReplaceLatestEntryTitle = $false,
|
[Boolean]$ReplaceLatestEntryTitle = $false,
|
||||||
[String]$ChangelogPath,
|
[String]$ChangelogPath,
|
||||||
[String]$ReleaseDate
|
[String]$ReleaseDate,
|
||||||
|
[String]$GroupId
|
||||||
)
|
)
|
||||||
Set-StrictMode -Version 3
|
Set-StrictMode -Version 3
|
||||||
|
|
||||||
@ -59,7 +61,7 @@ if ($null -eq [AzureEngSemanticVersion]::ParseVersionString($Version))
|
|||||||
|
|
||||||
if ([string]::IsNullOrEmpty($ChangelogPath))
|
if ([string]::IsNullOrEmpty($ChangelogPath))
|
||||||
{
|
{
|
||||||
$pkgProperties = Get-PkgProperties -PackageName $PackageName -ServiceDirectory $ServiceDirectory
|
$pkgProperties = Get-PkgProperties -PackageName $PackageName -ServiceDirectory $ServiceDirectory -GroupId $GroupId
|
||||||
$ChangelogPath = $pkgProperties.ChangeLogPath
|
$ChangelogPath = $pkgProperties.ChangeLogPath
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -111,13 +111,13 @@ function VerifyAPIReview($packageName, $packageVersion, $language)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function IsVersionShipped($packageName, $packageVersion)
|
function IsVersionShipped($packageName, $packageVersion, $groupId = $null)
|
||||||
{
|
{
|
||||||
# This function will decide if a package version is already shipped or not
|
# This function will decide if a package version is already shipped or not
|
||||||
Write-Host "Checking if a version is already shipped for package $packageName with version $packageVersion."
|
Write-Host "Checking if a version is already shipped for package $packageName with version $packageVersion."
|
||||||
$parsedNewVersion = [AzureEngSemanticVersion]::new($packageVersion)
|
$parsedNewVersion = [AzureEngSemanticVersion]::new($packageVersion)
|
||||||
$versionMajorMinor = "" + $parsedNewVersion.Major + "." + $parsedNewVersion.Minor
|
$versionMajorMinor = "" + $parsedNewVersion.Major + "." + $parsedNewVersion.Minor
|
||||||
$workItem = FindPackageWorkItem -lang $LanguageDisplayName -packageName $packageName -version $versionMajorMinor -includeClosed $true -outputCommand $false
|
$workItem = FindPackageWorkItem -lang $LanguageDisplayName -packageName $packageName -groupId $groupId -version $versionMajorMinor -includeClosed $true -outputCommand $false
|
||||||
if ($workItem)
|
if ($workItem)
|
||||||
{
|
{
|
||||||
# Check if the package version is already shipped
|
# Check if the package version is already shipped
|
||||||
@ -127,7 +127,7 @@ function IsVersionShipped($packageName, $packageVersion)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Write-Host "No work item found for package [$packageName]. Creating new work item for package."
|
Write-Host "No work item found for package [$packageName], group [$groupId]. Creating new work item for package."
|
||||||
}
|
}
|
||||||
return $false
|
return $false
|
||||||
}
|
}
|
||||||
@ -148,6 +148,7 @@ function CreateUpdatePackageWorkItem($pkgInfo)
|
|||||||
# Create or update package work item
|
# Create or update package work item
|
||||||
$result = Update-DevOpsReleaseWorkItem -language $LanguageDisplayName `
|
$result = Update-DevOpsReleaseWorkItem -language $LanguageDisplayName `
|
||||||
-packageName $packageName `
|
-packageName $packageName `
|
||||||
|
-groupId $pkgInfo.Group `
|
||||||
-version $versionString `
|
-version $versionString `
|
||||||
-plannedDate $plannedDate `
|
-plannedDate $plannedDate `
|
||||||
-packageRepoPath $pkgInfo.serviceDirectory `
|
-packageRepoPath $pkgInfo.serviceDirectory `
|
||||||
@ -175,15 +176,14 @@ function ProcessPackage($packageInfo)
|
|||||||
$pkgName = $packageInfo.Name
|
$pkgName = $packageInfo.Name
|
||||||
$changeLogPath = $packageInfo.ChangeLogPath
|
$changeLogPath = $packageInfo.ChangeLogPath
|
||||||
$versionString = $packageInfo.Version
|
$versionString = $packageInfo.Version
|
||||||
Write-Host "Checking if we need to create or update work item for package $pkgName with version $versionString."
|
Write-Host "Checking if we need to create or update work item for package $pkgName and groupId $packageInfo.Group with version $versionString."
|
||||||
$isShipped = IsVersionShipped $pkgName $versionString
|
Write-Host "Package name before checking groupId: $pkgName"
|
||||||
|
$isShipped = IsVersionShipped $pkgName $versionString $packageInfo.Group
|
||||||
if ($isShipped) {
|
if ($isShipped) {
|
||||||
Write-Host "Package work item already exists for version [$versionString] that is marked as shipped. Skipping the update of package work item."
|
Write-Host "Package work item already exists for version [$versionString] that is marked as shipped. Skipping the update of package work item."
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Host "Validating package $pkgName with version $versionString."
|
|
||||||
|
|
||||||
# Change log validation
|
# Change log validation
|
||||||
$changeLogStatus = [PSCustomObject]@{
|
$changeLogStatus = [PSCustomObject]@{
|
||||||
Name = "Change Log Validation"
|
Name = "Change Log Validation"
|
||||||
@ -197,19 +197,16 @@ function ProcessPackage($packageInfo)
|
|||||||
|
|
||||||
# If there's a groupId that means this is Java and pkgName = GroupId+ArtifactName
|
# If there's a groupId that means this is Java and pkgName = GroupId+ArtifactName
|
||||||
# but the VerifyAPIReview requires GroupId:ArtifactName
|
# but the VerifyAPIReview requires GroupId:ArtifactName
|
||||||
Write-Host "Package name before checking groupId: $fullPackageName"
|
# Technically we can use groupId+artifactName format in api view,
|
||||||
if ($packageInfo.PSObject.Members.Name -contains "Group") {
|
# however it will need to migrate the existing data and Java parser also needs the change.
|
||||||
$groupId = $packageInfo.Group
|
$fullPackageName = Get-FullPackageName -PackageInfo $packageInfo -UseColonSeparator
|
||||||
if ($groupId){
|
|
||||||
$fullPackageName = "${groupId}:$($packageInfo.ArtifactName)"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Write-Host "Checking API review status for package $fullPackageName"
|
Write-Host "Checking API review status for package $fullPackageName"
|
||||||
$apireviewDetails = VerifyAPIReview $fullPackageName $packageInfo.Version $Language
|
$apireviewDetails = VerifyAPIReview $fullPackageName $packageInfo.Version $Language
|
||||||
|
|
||||||
|
# The following object will be used to update package work item, the name should be package name only without groupId
|
||||||
$pkgValidationDetails= [PSCustomObject]@{
|
$pkgValidationDetails= [PSCustomObject]@{
|
||||||
Name = $pkgName
|
Name = $pkgName
|
||||||
|
GroupId = $packageInfo.Group
|
||||||
Version = $packageInfo.Version
|
Version = $packageInfo.Version
|
||||||
ChangeLogValidation = $changeLogStatus
|
ChangeLogValidation = $changeLogStatus
|
||||||
APIReviewValidation = $apireviewDetails.ApiviewApproval
|
APIReviewValidation = $apireviewDetails.ApiviewApproval
|
||||||
@ -220,6 +217,7 @@ function ProcessPackage($packageInfo)
|
|||||||
Write-Host "Output: $($output)"
|
Write-Host "Output: $($output)"
|
||||||
|
|
||||||
# Create json token file in artifact path
|
# Create json token file in artifact path
|
||||||
|
# Does the following validation file name also need to use full package name with groupId?
|
||||||
$tokenFile = Join-Path $ArtifactPath "$($packageInfo.ArtifactName)-Validation.json"
|
$tokenFile = Join-Path $ArtifactPath "$($packageInfo.ArtifactName)-Validation.json"
|
||||||
$output | Out-File -FilePath $tokenFile -Encoding utf8
|
$output | Out-File -FilePath $tokenFile -Encoding utf8
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user