Skip to content

Commit

Permalink
Sync eng/common directory with azure-sdk-tools for PR 1374 (#16764)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
azure-sdk and praveenkuttappan committed Feb 16, 2021
1 parent 3d0ae19 commit 5e94c0e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
2 changes: 2 additions & 0 deletions eng/common/pipelines/templates/steps/create-apireview.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
parameters:
ArtifactPath: $(Build.ArtifactStagingDirectory)
Artifacts: []
ConfigFileDir: $(Build.ArtifactStagingDirectory)/PackageInfo

steps:
- ${{ each artifact in parameters.Artifacts }}:
Expand All @@ -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}}
Expand Down
1 change: 1 addition & 0 deletions eng/common/scripts/Package-Properties.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class PackageProps
[string]$Group
[string]$SdkType
[boolean]$IsNewSdk
[string]$ArtifactName

PackageProps([string]$name, [string]$version, [string]$directoryPath, [string]$serviceDirectory)
{
Expand Down
14 changes: 11 additions & 3 deletions eng/common/scripts/Save-Package-Properties.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,24 @@ 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)
{
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
}
Expand All @@ -31,4 +40,3 @@ else
Write-Error "Package properties are not available for service directory $($serviceDirectory)"
exit 1
}

0 comments on commit 5e94c0e

Please sign in to comment.