Sync eng/common directory with azure-sdk-tools for PR 13005 (#6839)

* Add field for Spec Project Path property

* Reorder properties

* Cleanup

* Logging

* Move SpecProjectPath into Package-Properties.ps1

* Update SpecProjectPath

* Fix accidental removal of $title

* Create or update with SpecProjectPath

* Revert logic, cannot test

* Revert logic, cannot test

* Revert irrelevant file

* Retain title

* Review feedback

* Review feedback

---------

Co-authored-by: Daniel Jurek <djurek@microsoft.com>
This commit is contained in:
Azure SDK Bot 2025-12-02 12:10:35 -08:00 committed by GitHub
parent 512b4e31d2
commit 6378718b66
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 29 additions and 2 deletions

View File

@ -268,6 +268,7 @@ function FindPackageWorkItem($lang, $packageName, $version, $outputCommand = $tr
$fields += "Custom.Generated"
$fields += "Custom.RoadmapState"
$fields += "Microsoft.VSTS.Common.StateChangeDate"
$fields += "Custom.SpecProjectPath"
$fieldList = ($fields | ForEach-Object { "[$_]"}) -join ", "
$query = "SELECT ${fieldList} FROM WorkItems WHERE [Work Item Type] = 'Package'"
@ -516,6 +517,7 @@ function CreateOrUpdatePackageWorkItem($lang, $pkg, $verMajorMinor, $existingIte
$pkgType = $pkg.Type
$pkgNewLibrary = $pkg.New
$pkgRepoPath = $pkg.RepoPath
$specProjectPath = $pkg.SpecProjectPath
$serviceName = $pkg.ServiceName
$title = $lang + " - " + $pkg.DisplayName + " - " + $verMajorMinor
@ -1256,7 +1258,8 @@ function Update-DevOpsReleaseWorkItem {
[string]$packageNewLibrary = "true",
[string]$relatedWorkItemId = $null,
[string]$tag = $null,
[bool]$inRelease = $true
[bool]$inRelease = $true,
[string]$specProjectPath = ""
)
if (!(Get-Command az -ErrorAction SilentlyContinue)) {
@ -1280,6 +1283,7 @@ function Update-DevOpsReleaseWorkItem {
RepoPath = $packageRepoPath
Type = $packageType
New = $packageNewLibrary
SpecProjectPath = $specProjectPath
};
if (!$plannedDate) {
@ -1326,6 +1330,16 @@ function Update-DevOpsReleaseWorkItem {
}
$updatedWI = UpdatePackageVersions $workItem -plannedVersions $plannedVersions
if ((!$workItem.fields.ContainsKey('Custom.SpecProjectPath') -and $packageInfo.SpecProjectPath) -or
($workItem.fields.ContainsKey('Custom.SpecProjectPath') -and ($workItem.fields['Custom.SpecProjectPath'] -ne $packageInfo.SpecProjectPath))
) {
Write-Host "Updating SpecProjectPath to '$($packageInfo.SpecProjectPath)' for work item [$($workItem.id)]"
UpdateWorkItem `
-id $workItem.id `
-fields "`"Custom.SpecProjectPath=$($packageInfo.SpecProjectPath)`"" `
-outputCommand $false
}
Write-Host "Release tracking item is at https://dev.azure.com/azure-sdk/Release/_workitems/edit/$($updatedWI.id)/"
return $true
}

View File

@ -22,6 +22,10 @@ class PackageProps {
[HashTable]$ArtifactDetails
[HashTable]$CIParameters
# Path from root of azure-rest-api-specs repo to spec project (read from
# tsp-location.yaml if it exists in the package directory)
[string]$SpecProjectPath
PackageProps([string]$name, [string]$version, [string]$directoryPath, [string]$serviceDirectory) {
$this.Initialize($name, $version, $directoryPath, $serviceDirectory)
}
@ -61,6 +65,13 @@ class PackageProps {
$this.ChangeLogPath = $null
}
if (Test-Path (Join-Path $directoryPath 'tsp-location.yaml')) {
$tspLocation = LoadFrom-Yaml (Join-Path $directoryPath 'tsp-location.yaml')
if ($tspLocation -and $tspLocation.directory) {
$this.SpecProjectPath = $tspLocation.directory
}
}
$this.CIParameters = @{"CIMatrixConfigs" = @()}
$this.InitializeCIArtifacts()
}

View File

@ -144,6 +144,7 @@ foreach ($pkg in $allPackageProperties)
if (-not [System.String]::IsNullOrEmpty($pkg.Group)) {
Write-Host "GroupId: $($pkg.Group)"
}
Write-Host "Spec Project Path: $($pkg.SpecProjectPath)"
Write-Host "Release date: $($pkg.ReleaseStatus)"
$configFilePrefix = $pkg.Name

View File

@ -155,7 +155,8 @@ function CreateUpdatePackageWorkItem($pkgInfo)
-packageNewLibrary $pkgInfo.IsNewSDK `
-serviceName "unknown" `
-packageDisplayName "unknown" `
-inRelease $IsReleaseBuild
-inRelease $IsReleaseBuild `
-specProjectPath $pkgInfo.SpecProjectPath
if (-not $result)
{