diff --git a/eng/common/pipelines/templates/steps/create-apireview.yml b/eng/common/pipelines/templates/steps/create-apireview.yml index 7628b22a1..427bb0971 100644 --- a/eng/common/pipelines/templates/steps/create-apireview.yml +++ b/eng/common/pipelines/templates/steps/create-apireview.yml @@ -1,6 +1,7 @@ parameters: ArtifactPath: $(Build.ArtifactStagingDirectory) Artifacts: [] + ConfigFileDir: $(Build.ArtifactStagingDirectory)/PackageInfo steps: - ${{ each artifact in parameters.Artifacts }}: @@ -13,6 +14,7 @@ steps: -APIKey $(azuresdk-apiview-apikey) -APILabel "Auto Review - $(Build.SourceVersion)" -PackageName ${{artifact.name}} + -ConfigFileDir '${{parameters.ConfigFileDir}}' pwsh: true workingDirectory: $(Pipeline.Workspace) displayName: Create API Review for ${{ artifact.name}} diff --git a/eng/common/scripts/Package-Properties.ps1 b/eng/common/scripts/Package-Properties.ps1 index f582a4a74..c49b0877a 100644 --- a/eng/common/scripts/Package-Properties.ps1 +++ b/eng/common/scripts/Package-Properties.ps1 @@ -12,6 +12,7 @@ class PackageProps [string]$Group [string]$SdkType [boolean]$IsNewSdk + [string]$ArtifactName PackageProps([string]$name, [string]$version, [string]$directoryPath, [string]$serviceDirectory) { diff --git a/eng/common/scripts/Save-Package-Properties.ps1 b/eng/common/scripts/Save-Package-Properties.ps1 index a433b32d8..3de894349 100644 --- a/eng/common/scripts/Save-Package-Properties.ps1 +++ b/eng/common/scripts/Save-Package-Properties.ps1 @@ -10,7 +10,10 @@ Param ( $allPackageProperties = Get-AllPkgProperties $serviceDirectory if ($allPackageProperties) { - New-Item -ItemType Directory -Force -Path $outDirectory + if (-not (Test-Path -Path $outDirectory)) + { + New-Item -ItemType Directory -Force -Path $outDirectory + } foreach($pkg in $allPackageProperties) { if ($pkg.IsNewSdk) @@ -18,7 +21,13 @@ if ($allPackageProperties) Write-Host "Package Name: $($pkg.Name)" Write-Host "Package Version: $($pkg.Version)" Write-Host "Package SDK Type: $($pkg.SdkType)" - $outputPath = Join-Path -Path $outDirectory ($pkg.Name + ".json") + Write-Host "Artifact Name: $($pkg.ArtifactName)" + $configFilePrefix = $pkg.Name + if ($pkg.ArtifactName) + { + $configFilePrefix = $pkg.ArtifactName + } + $outputPath = Join-Path -Path $outDirectory "$configFilePrefix.json" $outputObject = $pkg | ConvertTo-Json Set-Content -Path $outputPath -Value $outputObject } @@ -31,4 +40,3 @@ else Write-Error "Package properties are not available for service directory $($serviceDirectory)" exit 1 } -