Sync eng/common directory with azure-sdk-tools for PR 1374 (#1686)

* 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 <prmarott@microsoft.com>
This commit is contained in:
Azure SDK Bot 2021-02-16 11:57:56 -08:00 committed by GitHub
parent b68a20e3d2
commit f929894274
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 3 deletions

View File

@ -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}}

View File

@ -12,6 +12,7 @@ class PackageProps
[string]$Group
[string]$SdkType
[boolean]$IsNewSdk
[string]$ArtifactName
PackageProps([string]$name, [string]$version, [string]$directoryPath, [string]$serviceDirectory)
{

View File

@ -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
}