-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Sync eng/common directory with azure-sdk-tools for PR 13005 #47355
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
3ce3233
8759e86
2cd02ac
3fee149
7bb883f
40cfb81
0744c8d
3023432
9854ecc
bf27cf4
badd251
9e49997
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -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,10 @@ class PackageProps { | |||||||||||
| $this.ChangeLogPath = $null | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| if (Test-Path (Join-Path $directoryPath 'tsp-location.yaml')) { | ||||||||||||
| $this.SpecProjectPath = (LoadFrom-Yaml (Join-Path $directoryPath 'tsp-location.yaml')).directory | ||||||||||||
|
||||||||||||
| $this.SpecProjectPath = (LoadFrom-Yaml (Join-Path $directoryPath 'tsp-location.yaml')).directory | |
| $tspLocation = LoadFrom-Yaml (Join-Path $directoryPath 'tsp-location.yaml') | |
| if ($tspLocation -and $tspLocation.directory) { | |
| $this.SpecProjectPath = $tspLocation.directory | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The condition logic for updating
SpecProjectPathhas a potential issue. When$packageInfo.SpecProjectPathis an empty string (not null), the first condition!$workItem.fields.ContainsKey('Custom.SpecProjectPath') -and $packageInfo.SpecProjectPathwill evaluate to false (because empty string is falsy in PowerShell), but the second condition will try to compare against the empty string.Consider being more explicit about null/empty checks:
This ensures we only update when there's actually a non-empty value to set, and properly handles both missing fields and value mismatches.