Skip to content

Commit 5e94c0e

Browse files
Sync eng/common directory with azure-sdk-tools for PR 1374 (#16764)
* Create package property file using artifact name * Add option to pass config file dir * Set default config file directory to avoid script execution failure Co-authored-by: praveenkuttappan <[email protected]>
1 parent 3d0ae19 commit 5e94c0e

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

eng/common/pipelines/templates/steps/create-apireview.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
parameters:
22
ArtifactPath: $(Build.ArtifactStagingDirectory)
33
Artifacts: []
4+
ConfigFileDir: $(Build.ArtifactStagingDirectory)/PackageInfo
45

56
steps:
67
- ${{ each artifact in parameters.Artifacts }}:
@@ -13,6 +14,7 @@ steps:
1314
-APIKey $(azuresdk-apiview-apikey)
1415
-APILabel "Auto Review - $(Build.SourceVersion)"
1516
-PackageName ${{artifact.name}}
17+
-ConfigFileDir '${{parameters.ConfigFileDir}}'
1618
pwsh: true
1719
workingDirectory: $(Pipeline.Workspace)
1820
displayName: Create API Review for ${{ artifact.name}}

eng/common/scripts/Package-Properties.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class PackageProps
1212
[string]$Group
1313
[string]$SdkType
1414
[boolean]$IsNewSdk
15+
[string]$ArtifactName
1516

1617
PackageProps([string]$name, [string]$version, [string]$directoryPath, [string]$serviceDirectory)
1718
{

eng/common/scripts/Save-Package-Properties.ps1

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,24 @@ Param (
1010
$allPackageProperties = Get-AllPkgProperties $serviceDirectory
1111
if ($allPackageProperties)
1212
{
13-
New-Item -ItemType Directory -Force -Path $outDirectory
13+
if (-not (Test-Path -Path $outDirectory))
14+
{
15+
New-Item -ItemType Directory -Force -Path $outDirectory
16+
}
1417
foreach($pkg in $allPackageProperties)
1518
{
1619
if ($pkg.IsNewSdk)
1720
{
1821
Write-Host "Package Name: $($pkg.Name)"
1922
Write-Host "Package Version: $($pkg.Version)"
2023
Write-Host "Package SDK Type: $($pkg.SdkType)"
21-
$outputPath = Join-Path -Path $outDirectory ($pkg.Name + ".json")
24+
Write-Host "Artifact Name: $($pkg.ArtifactName)"
25+
$configFilePrefix = $pkg.Name
26+
if ($pkg.ArtifactName)
27+
{
28+
$configFilePrefix = $pkg.ArtifactName
29+
}
30+
$outputPath = Join-Path -Path $outDirectory "$configFilePrefix.json"
2231
$outputObject = $pkg | ConvertTo-Json
2332
Set-Content -Path $outputPath -Value $outputObject
2433
}
@@ -31,4 +40,3 @@ else
3140
Write-Error "Package properties are not available for service directory $($serviceDirectory)"
3241
exit 1
3342
}
34-

0 commit comments

Comments
 (0)