Compare commits

..

2 Commits

Author SHA1 Message Date
Azure SDK Bot
78de0b7c25
LogGroupStart should have local build output (#6867)
Co-authored-by: Patrick Hallisey <pahallis@microsoft.com>
2025-12-08 23:26:27 -08:00
Azure SDK Bot
884ff2fbab
Sync eng/common directory with azure-sdk-tools for PR 13267 (#6866)
* Updated artifactJson input to artifacts input

* Prioritized service directory from artifact object over the parameter input

* Returned error when service directory is not provided for the old usage

* Removed redudant line

* Initilized the variable in a loop

---------

Co-authored-by: ray chen <raychen@microsoft.com>
2025-12-08 17:37:27 -08:00
8 changed files with 104 additions and 148 deletions

View File

@ -14,9 +14,9 @@ parameters:
- name: TestPipeline
type: boolean
default: false
- name: ArtifactsJson
type: string
default: ''
- name: Artifacts
type: object
default: []
steps:
- ${{ if eq(parameters.TestPipeline, true) }}:
@ -31,5 +31,5 @@ steps:
-PackageNames '${{ coalesce(parameters.PackageName, parameters.PackageNames) }}'
-ServiceDirectory '${{ parameters.ServiceDirectory }}'
-TagSeparator '${{ parameters.TagSeparator }}'
-ArtifactsJson '${{ parameters.ArtifactsJson }}'
-Artifacts @('${{ replace(convertToJson(parameters.Artifacts), '''', '`''') }}' | ConvertFrom-Json)
pwsh: true

View File

@ -215,17 +215,16 @@ function FindParentWorkItem($serviceName, $packageDisplayName, $outputCommand =
$packageWorkItems = @{}
$packageWorkItemWithoutKeyFields = @{}
function FindLatestPackageWorkItem($lang, $packageName, $groupId = $null, $outputCommand = $true, $ignoreReleasePlannerTests = $true, $tag = $null)
function FindLatestPackageWorkItem($lang, $packageName, $outputCommand = $true, $ignoreReleasePlannerTests = $true, $tag = $null)
{
# Cache all the versions of this package and language work items
$null = FindPackageWorkItem $lang $packageName -includeClosed $true -outputCommand $outputCommand -ignoreReleasePlannerTests $ignoreReleasePlannerTests -tag $tag -groupId $groupId
$null = FindPackageWorkItem $lang $packageName -includeClosed $true -outputCommand $outputCommand -ignoreReleasePlannerTests $ignoreReleasePlannerTests -tag $tag
$latestWI = $null
foreach ($wi in $packageWorkItems.Values)
{
if ($wi.fields["Custom.Language"] -ne $lang) { continue }
if ($wi.fields["Custom.Package"] -ne $packageName) { continue }
if ($groupId -and $wi.fields["Custom.GroupId"] -ne $groupId) { continue }
if (!$latestWI) {
$latestWI = $wi
@ -239,9 +238,9 @@ function FindLatestPackageWorkItem($lang, $packageName, $groupId = $null, $outpu
return $latestWI
}
function FindPackageWorkItem($lang, $packageName, $version, $groupId = $null, $outputCommand = $true, $includeClosed = $false, $ignoreReleasePlannerTests = $true, $tag = $null)
function FindPackageWorkItem($lang, $packageName, $version, $outputCommand = $true, $includeClosed = $false, $ignoreReleasePlannerTests = $true, $tag = $null)
{
$key = BuildHashKey $lang $packageName $version $groupId
$key = BuildHashKeyNoNull $lang $packageName $version
if ($key -and $packageWorkItems.ContainsKey($key)) {
return $packageWorkItems[$key]
}
@ -254,7 +253,6 @@ function FindPackageWorkItem($lang, $packageName, $version, $groupId = $null, $o
$fields += "System.Tags"
$fields += "Custom.Language"
$fields += "Custom.Package"
$fields += "Custom.GroupId"
$fields += "Custom.PackageDisplayName"
$fields += "System.Title"
$fields += "Custom.PackageType"
@ -284,9 +282,6 @@ function FindPackageWorkItem($lang, $packageName, $version, $groupId = $null, $o
if ($packageName) {
$query += " AND [Package] = '${packageName}'"
}
if ($groupId) {
$query += " AND [GroupId] = '${groupId}'"
}
if ($version) {
$query += " AND [PackageVersionMajorMinor] = '${version}'"
}
@ -300,7 +295,7 @@ function FindPackageWorkItem($lang, $packageName, $version, $groupId = $null, $o
foreach ($wi in $workItems)
{
$localKey = BuildHashKey $wi.fields["Custom.Language"] $wi.fields["Custom.Package"] $wi.fields["Custom.PackageVersionMajorMinor"] $wi.fields["Custom.GroupId"]
$localKey = BuildHashKeyNoNull $wi.fields["Custom.Language"] $wi.fields["Custom.Package"] $wi.fields["Custom.PackageVersionMajorMinor"]
if (!$localKey) {
$packageWorkItemWithoutKeyFields[$wi.id] = $wi
Write-Host "Skipping package [$($wi.id)]$($wi.fields['System.Title']) which is missing required fields language, package, or version."
@ -466,10 +461,10 @@ function UpdatePackageWorkItemReleaseState($id, $state, $releaseType, $outputCom
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 -groupId $pkg.GroupId
$workItem = FindPackageWorkItem -lang $lang -packageName $pkg.Package -version $verMajorMinor -includeClosed $true -outputCommand $outputCommand -tag $tag -ignoreReleasePlannerTests $ignoreReleasePlannerTests
if (!$workItem) {
$latestVersionItem = FindLatestPackageWorkItem -lang $lang -packageName $pkg.Package -outputCommand $outputCommand -tag $tag -ignoreReleasePlannerTests $ignoreReleasePlannerTests -groupId $pkg.GroupId
$latestVersionItem = FindLatestPackageWorkItem -lang $lang -packageName $pkg.Package -outputCommand $outputCommand -tag $tag -ignoreReleasePlannerTests $ignoreReleasePlannerTests
$assignedTo = "me"
$extraFields = @()
if ($latestVersionItem) {
@ -517,13 +512,6 @@ 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]"
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
$pkgDisplayName = $pkg.DisplayName
$pkgType = $pkg.Type
@ -535,7 +523,6 @@ function CreateOrUpdatePackageWorkItem($lang, $pkg, $verMajorMinor, $existingIte
$fields = @()
$fields += "`"Language=${lang}`""
$fields += "`"Package=${pkgName}`""
$fields += "`"GroupId=${pkgGroupId}`""
$fields += "`"PackageDisplayName=${pkgDisplayName}`""
$fields += "`"PackageType=${pkgType}`""
$fields += "`"PackageTypeNewLibrary=${pkgNewLibrary}`""
@ -553,7 +540,6 @@ function CreateOrUpdatePackageWorkItem($lang, $pkg, $verMajorMinor, $existingIte
if ($lang -ne $existingItem.fields["Custom.Language"]) { $changedField = "Custom.Language" }
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 ($pkgDisplayName -ne $existingItem.fields["Custom.PackageDisplayName"]) { $changedField = "Custom.PackageDisplayName" }
if ($pkgType -ne [string]$existingItem.fields["Custom.PackageType"]) { $changedField = "Custom.PackageType" }
@ -1043,16 +1029,15 @@ function UpdatePackageVersions($pkgWorkItem, $plannedVersions, $shippedVersions)
function UpdateValidationStatus($pkgvalidationDetails, $BuildDefinition, $PipelineUrl)
{
$pkgName = $pkgValidationDetails.Name
$groupId = $pkgValidationDetails.GroupId
$versionString = $pkgValidationDetails.Version
$parsedNewVersion = [AzureEngSemanticVersion]::new($versionString)
$versionMajorMinor = "" + $parsedNewVersion.Major + "." + $parsedNewVersion.Minor
$workItem = FindPackageWorkItem -lang $LanguageDisplayName -packageName $pkgName -groupId $groupId -version $versionMajorMinor -includeClosed $true -outputCommand $false
$workItem = FindPackageWorkItem -lang $LanguageDisplayName -packageName $pkgName -version $versionMajorMinor -includeClosed $true -outputCommand $false
if (!$workItem)
{
Write-Host "No work item found for package [$pkgName] with groupId [$groupId]."
Write-Host"No work item found for package [$pkgName]."
return $false
}
@ -1265,7 +1250,6 @@ function Update-DevOpsReleaseWorkItem {
[Parameter(Mandatory=$true)]
[string]$version,
[string]$plannedDate,
[string]$groupId = $null,
[string]$serviceName = $null,
[string]$packageDisplayName = $null,
[string]$packageRepoPath = "NA",
@ -1293,7 +1277,6 @@ function Update-DevOpsReleaseWorkItem {
$packageInfo = [PSCustomObject][ordered]@{
Package = $packageName
GroupId = $groupId
DisplayName = $packageDisplayName
ServiceName = $serviceName
RepoPath = $packageRepoPath

View File

@ -230,30 +230,16 @@ class PackageProps {
# Returns important properties of the package relative to the language repo
# Returns a PS Object with properties @ { pkgName, pkgVersion, pkgDirectoryPath, pkgReadMePath, pkgChangeLogPath }
# 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 {
Param
(
[Parameter(Mandatory = $true)]
[string]$PackageName,
[string]$ServiceDirectory,
[string]$GroupId
[string]$ServiceDirectory
)
Write-Host "Get-PkgProperties called with PackageName: [$PackageName], ServiceDirectory: [$ServiceDirectory], GroupId: [$GroupId]"
$allPkgProps = Get-AllPkgProperties -ServiceDirectory $ServiceDirectory
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)
});
}
$pkgProps = $allPkgProps.Where({ $_.Name -eq $PackageName -or $_.ArtifactName -eq $PackageName });
if ($pkgProps.Count -ge 1) {
if ($pkgProps.Count -gt 1) {
@ -262,12 +248,7 @@ function Get-PkgProperties {
return $pkgProps[0]
}
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."
}
LogError "Failed to retrieve Properties for [$PackageName]"
return $null
}
@ -587,25 +568,3 @@ function Get-PkgPropsForEntireService ($serviceDirectoryPath) {
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
}

View File

@ -30,9 +30,6 @@ If one isn't provided, then it will compute the next ship date or today's date i
.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.
.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
PS> ./eng/common/scripts/Prepare-Release.ps1 <PackageName>
@ -52,8 +49,7 @@ param(
[string]$PackageName,
[string]$ServiceDirectory,
[string]$ReleaseDate, # Pass Date in the form MM/dd/yyyy"
[switch]$ReleaseTrackingOnly = $false,
[string]$GroupId
[switch]$ReleaseTrackingOnly = $false
)
Set-StrictMode -Version 3
@ -61,18 +57,6 @@ Set-StrictMode -Version 3
. ${PSScriptRoot}\Helpers\ApiView-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)
{
# Find first friday
@ -90,7 +74,7 @@ function Get-ReleaseDay($baseDate)
$ErrorPreference = 'Stop'
$packageProperties = $null
$packageProperties = Get-PkgProperties -PackageName $PackageName -ServiceDirectory $ServiceDirectory -GroupId $GroupId
$packageProperties = Get-PkgProperties -PackageName $PackageName -ServiceDirectory $ServiceDirectory
if (!$packageProperties)
{
@ -144,7 +128,7 @@ if (Test-Path "Function:GetExistingPackageVersions")
}
$currentProjectVersion = $packageProperties.Version
$newVersion = Read-Host -Prompt "Input the new version, or press Enter to use current project version '$currentProjectVersion'"
$newVersion = Read-Host -Prompt "Input the new version, or press Enter to use use current project version '$currentProjectVersion'"
if (!$newVersion)
{
@ -160,7 +144,6 @@ if ($null -eq $newVersionParsed)
$result = Update-DevOpsReleaseWorkItem -language $LanguageDisplayName `
-packageName $packageProperties.Name `
-groupId $packageProperties.Group `
-version $newVersion `
-plannedDate $releaseDateString `
-packageRepoPath $packageProperties.serviceDirectory `
@ -183,8 +166,7 @@ try
}
$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"
$fullPackageNameInApiView = Get-FullPackageName -PackageInfo $packageProperties -UseColonSeparator
Check-ApiReviewStatus -PackageName $fullPackageNameInApiView -packageVersion $newVersion -Language $LanguageDisplayName -url $url -apiKey $apiKey
Check-ApiReviewStatus -PackageName $packageProperties.Name -packageVersion $newVersion -Language $LanguageDisplayName -url $url -apiKey $apiKey
}
catch
{
@ -212,7 +194,7 @@ if (Test-Path "Function:SetPackageVersion")
}
SetPackageVersion -PackageName $packageProperties.Name -Version $newVersion `
-ServiceDirectory $packageProperties.ServiceDirectory -ReleaseDate $releaseDateString `
-PackageProperties $packageProperties -ReplaceLatestEntryTitle $replaceLatestEntryTitle -GroupId $packageProperties.Group
-PackageProperties $packageProperties -ReplaceLatestEntryTitle $replaceLatestEntryTitle
}
else
{

View File

@ -5,63 +5,83 @@ param (
[string]$BuildID,
[Parameter(mandatory = $false)]
[string]$PackageNames = "",
[Parameter(mandatory = $true)]
[Parameter(mandatory = $false)]
# ServiceDirectory is required when using PackageNames,
# or when Artifacts do not include their own ServiceDirectory property.
[string]$ServiceDirectory,
[Parameter(mandatory = $false)]
[string]$TagSeparator = "_",
[Parameter(mandatory = $false)]
[string]$ArtifactsJson = ""
[object[]]$Artifacts = @()
)
. (Join-Path $PSScriptRoot common.ps1)
# Ensure Artifacts is always an array
$Artifacts = @($Artifacts)
Write-Host "PackageNames: $PackageNames"
Write-Host "ServiceDirectory: $ServiceDirectory"
Write-Host "BuildID: $BuildID"
Write-Host "ArtifactsJson: $ArtifactsJson"
Write-Host "Artifacts count: $($Artifacts.Count)"
$packageNamesArray = @()
$artifacts = $null
# If ArtifactsJson is provided, extract package names from it
if (![String]::IsNullOrWhiteSpace($ArtifactsJson)) {
Write-Host "Using ArtifactsJson to determine package names"
if ($Artifacts -and $Artifacts.Count -gt 0) {
# When using Artifacts, process each artifact with its name and groupId (if applicable)
try {
$artifacts = $ArtifactsJson | ConvertFrom-Json
$packageNamesArray = $artifacts | ForEach-Object { $_.name }
Write-Host "Extracted package names from ArtifactsJson: $($packageNamesArray -join ', ')"
}
catch {
LogError "Failed to parse ArtifactsJson: $($_.Exception.Message)"
exit 1
}
}
elseif (![String]::IsNullOrWhiteSpace($PackageNames)) {
$packageNamesArray = $PackageNames.Split(',')
}
else {
LogError "Either PackageNames or ArtifactsJson must be provided."
exit 1
}
foreach ($artifact in $Artifacts) {
# Validate required properties
if (-not (Get-Member -InputObject $artifact -Name 'name' -MemberType Properties)) {
LogError "Artifact is missing required 'name' property."
exit 1
}
if ($artifacts) {
# When using ArtifactsJson, process each artifact with its name and groupId (if applicable)
try {
foreach ($artifact in $artifacts) {
$packageName = $artifact.name
if ([String]::IsNullOrWhiteSpace($packageName)) {
LogError "Artifact 'name' property is null or empty."
exit 1
}
$artifactServiceDirectory = $null
# Check for ServiceDirectory property
if (Get-Member -InputObject $artifact -Name 'ServiceDirectory' -MemberType Properties) {
if (![String]::IsNullOrWhiteSpace($artifact.ServiceDirectory)) {
$artifactServiceDirectory = $artifact.ServiceDirectory
}
}
if ([String]::IsNullOrWhiteSpace($artifactServiceDirectory)) {
$artifactServiceDirectory = $ServiceDirectory
}
# Validate ServiceDirectory is available
if ([String]::IsNullOrWhiteSpace($artifactServiceDirectory)) {
LogError "ServiceDirectory is required but not provided for artifact '$packageName'. Provide it via script parameter or artifact property."
exit 1
}
$newVersion = [AzureEngSemanticVersion]::new("1.0.0")
$prefix = "$packageName$TagSeparator"
if ($Language -eq "java") {
# Check for groupId property
if (-not (Get-Member -InputObject $artifact -Name 'groupId' -MemberType Properties)) {
LogError "Artifact '$packageName' is missing required 'groupId' property for Java language."
exit 1
}
$groupId = $artifact.groupId
Write-Host "Processing $packageName with groupId $groupId"
if ([String]::IsNullOrWhiteSpace($groupId)) {
LogError "GroupId is missing for package $packageName."
exit 1
}
Write-Host "Processing $packageName with groupId $groupId"
# Use groupId+artifactName format for tag prefix (e.g., "com.azure.v2+azure-sdk-template_")
$prefix = "$groupId+$packageName$TagSeparator"
}
else {
Write-Host "Processing $packageName"
}
Write-Host "Get Latest Tag : git tag -l $prefix*"
$latestTags = git tag -l "$prefix*"
@ -87,21 +107,27 @@ if ($artifacts) {
if ($Language -ne "java") {
SetPackageVersion -PackageName $packageName `
-Version $newVersion.ToString() `
-ServiceDirectory $ServiceDirectory
-ServiceDirectory $artifactServiceDirectory
} else {
SetPackageVersion -PackageName $packageName `
-Version $newVersion.ToString() `
-ServiceDirectory $ServiceDirectory `
-ServiceDirectory $artifactServiceDirectory `
-GroupId $groupId
}
}
}
catch {
LogError "Failed to process ArtifactsJson: $ArtifactsJson, exception: $($_.Exception.Message)"
LogError "Failed to process Artifacts: exception: $($_.Exception.Message)"
exit 1
}
} else {
} elseif (![String]::IsNullOrWhiteSpace($PackageNames)) {
# Fallback to original logic when using PackageNames string
if ([String]::IsNullOrWhiteSpace($ServiceDirectory)) {
LogError "ServiceDirectory is required when using PackageNames."
exit 1
}
$packageNamesArray = $PackageNames.Split(',')
foreach ($packageName in $packageNamesArray) {
Write-Host "Processing $packageName"
$newVersion = [AzureEngSemanticVersion]::new("1.0.0")
@ -131,4 +157,7 @@ if ($artifacts) {
-Version $newVersion.ToString() `
-ServiceDirectory $ServiceDirectory
}
} else {
LogError "Either PackageNames or Artifacts must be provided."
exit 1
}

View File

@ -4,7 +4,6 @@
# 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"
# 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()]
param (
@ -15,8 +14,7 @@ param (
[Boolean]$Unreleased = $true,
[Boolean]$ReplaceLatestEntryTitle = $false,
[String]$ChangelogPath,
[String]$ReleaseDate,
[String]$GroupId
[String]$ReleaseDate
)
Set-StrictMode -Version 3
@ -61,7 +59,7 @@ if ($null -eq [AzureEngSemanticVersion]::ParseVersionString($Version))
if ([string]::IsNullOrEmpty($ChangelogPath))
{
$pkgProperties = Get-PkgProperties -PackageName $PackageName -ServiceDirectory $ServiceDirectory -GroupId $GroupId
$pkgProperties = Get-PkgProperties -PackageName $PackageName -ServiceDirectory $ServiceDirectory
$ChangelogPath = $pkgProperties.ChangeLogPath
}

View File

@ -111,13 +111,13 @@ function VerifyAPIReview($packageName, $packageVersion, $language)
}
function IsVersionShipped($packageName, $packageVersion, $groupId = $null)
function IsVersionShipped($packageName, $packageVersion)
{
# 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."
$parsedNewVersion = [AzureEngSemanticVersion]::new($packageVersion)
$versionMajorMinor = "" + $parsedNewVersion.Major + "." + $parsedNewVersion.Minor
$workItem = FindPackageWorkItem -lang $LanguageDisplayName -packageName $packageName -groupId $groupId -version $versionMajorMinor -includeClosed $true -outputCommand $false
$workItem = FindPackageWorkItem -lang $LanguageDisplayName -packageName $packageName -version $versionMajorMinor -includeClosed $true -outputCommand $false
if ($workItem)
{
# Check if the package version is already shipped
@ -127,7 +127,7 @@ function IsVersionShipped($packageName, $packageVersion, $groupId = $null)
}
}
else {
Write-Host "No work item found for package [$packageName], group [$groupId]. Creating new work item for package."
Write-Host "No work item found for package [$packageName]. Creating new work item for package."
}
return $false
}
@ -148,7 +148,6 @@ function CreateUpdatePackageWorkItem($pkgInfo)
# Create or update package work item
$result = Update-DevOpsReleaseWorkItem -language $LanguageDisplayName `
-packageName $packageName `
-groupId $pkgInfo.Group `
-version $versionString `
-plannedDate $plannedDate `
-packageRepoPath $pkgInfo.serviceDirectory `
@ -176,14 +175,15 @@ function ProcessPackage($packageInfo)
$pkgName = $packageInfo.Name
$changeLogPath = $packageInfo.ChangeLogPath
$versionString = $packageInfo.Version
Write-Host "Checking if we need to create or update work item for package $pkgName and groupId $packageInfo.Group with version $versionString."
Write-Host "Package name before checking groupId: $pkgName"
$isShipped = IsVersionShipped $pkgName $versionString $packageInfo.Group
Write-Host "Checking if we need to create or update work item for package $pkgName with version $versionString."
$isShipped = IsVersionShipped $pkgName $versionString
if ($isShipped) {
Write-Host "Package work item already exists for version [$versionString] that is marked as shipped. Skipping the update of package work item."
return
}
Write-Host "Validating package $pkgName with version $versionString."
# Change log validation
$changeLogStatus = [PSCustomObject]@{
Name = "Change Log Validation"
@ -197,16 +197,19 @@ function ProcessPackage($packageInfo)
# If there's a groupId that means this is Java and pkgName = GroupId+ArtifactName
# but the VerifyAPIReview requires GroupId:ArtifactName
# Technically we can use groupId+artifactName format in api view,
# however it will need to migrate the existing data and Java parser also needs the change.
$fullPackageName = Get-FullPackageName -PackageInfo $packageInfo -UseColonSeparator
Write-Host "Package name before checking groupId: $fullPackageName"
if ($packageInfo.PSObject.Members.Name -contains "Group") {
$groupId = $packageInfo.Group
if ($groupId){
$fullPackageName = "${groupId}:$($packageInfo.ArtifactName)"
}
}
Write-Host "Checking API review status for package $fullPackageName"
$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]@{
Name = $pkgName
GroupId = $packageInfo.Group
Version = $packageInfo.Version
ChangeLogValidation = $changeLogStatus
APIReviewValidation = $apireviewDetails.ApiviewApproval
@ -217,7 +220,6 @@ function ProcessPackage($packageInfo)
Write-Host "Output: $($output)"
# 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"
$output | Out-File -FilePath $tokenFile -Encoding utf8

View File

@ -94,6 +94,9 @@ function LogGroupStart() {
elseif (Test-SupportsGitHubLogging) {
Write-Host "::group::$args"
}
else {
Write-Host "> $args"
}
}
function LogGroupEnd() {