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:
parent
b68a20e3d2
commit
f929894274
@ -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}}
|
||||
|
||||
@ -12,6 +12,7 @@ class PackageProps
|
||||
[string]$Group
|
||||
[string]$SdkType
|
||||
[boolean]$IsNewSdk
|
||||
[string]$ArtifactName
|
||||
|
||||
PackageProps([string]$name, [string]$version, [string]$directoryPath, [string]$serviceDirectory)
|
||||
{
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user