Sync eng/common directory with azure-sdk-tools for PR 8879 (#30893)
Sync eng/common directory with azure-sdk-tools for PR https://github.com/Azure/azure-sdk-tools/pull/8879 See [eng/common workflow](https://github.com/Azure/azure-sdk-tools/blob/main/eng/common/README.md#workflow) Co-authored-by: Patrick Hallisey <pahallis@microsoft.com>
This commit is contained in:
Родитель
0a7913a414
Коммит
43e8e1bd38
|
@ -99,56 +99,63 @@ $exportedPaths = @{}
|
||||||
$allPackageProperties = @()
|
$allPackageProperties = @()
|
||||||
|
|
||||||
if ($prDiff) {
|
if ($prDiff) {
|
||||||
|
Write-Host "Getting package properties for PR diff file: $prDiff"
|
||||||
$allPackageProperties = Get-PrPkgProperties $prDiff
|
$allPackageProperties = Get-PrPkgProperties $prDiff
|
||||||
|
|
||||||
|
if (!$allPackageProperties) {
|
||||||
|
Write-Host "No packages found matching PR diff file $prDiff"
|
||||||
|
Write-Host "Setting NoPackagesChanged variable to true"
|
||||||
|
Write-Host "##vso[task.setvariable variable=NoPackagesChanged]true"
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
Write-Host "Getting package properties for service directory: $serviceDirectory"
|
||||||
$allPackageProperties = Get-AllPkgProperties $serviceDirectory
|
$allPackageProperties = Get-AllPkgProperties $serviceDirectory
|
||||||
}
|
|
||||||
|
|
||||||
if ($allPackageProperties)
|
if (!$allPackageProperties) {
|
||||||
{
|
Write-Error "Package properties are not available for service directory $serviceDirectory"
|
||||||
if (-not (Test-Path -Path $outDirectory))
|
|
||||||
{
|
|
||||||
New-Item -ItemType Directory -Force -Path $outDirectory
|
|
||||||
}
|
|
||||||
foreach($pkg in $allPackageProperties)
|
|
||||||
{
|
|
||||||
if ($pkg.Name) {
|
|
||||||
Write-Host "Package Name: $($pkg.Name)"
|
|
||||||
Write-Host "Package Version: $($pkg.Version)"
|
|
||||||
Write-Host "Package SDK Type: $($pkg.SdkType)"
|
|
||||||
Write-Host "Artifact Name: $($pkg.ArtifactName)"
|
|
||||||
Write-Host "Release date: $($pkg.ReleaseStatus)"
|
|
||||||
$configFilePrefix = $pkg.Name
|
|
||||||
if ($pkg.ArtifactName)
|
|
||||||
{
|
|
||||||
$configFilePrefix = $pkg.ArtifactName
|
|
||||||
}
|
|
||||||
$outputPath = Join-Path -Path $outDirectory "$configFilePrefix.json"
|
|
||||||
Write-Host "Output path of json file: $outputPath"
|
|
||||||
$outDir = Split-Path $outputPath -parent
|
|
||||||
if (-not (Test-Path -path $outDir))
|
|
||||||
{
|
|
||||||
Write-Host "Creating directory $($outDir) for json property file"
|
|
||||||
New-Item -ItemType Directory -Path $outDir
|
|
||||||
}
|
|
||||||
|
|
||||||
# If package properties for a track 2 (IsNewSdk = true) package has
|
|
||||||
# already been written, skip writing to that same path.
|
|
||||||
if ($exportedPaths.ContainsKey($outputPath) -and $exportedPaths[$outputPath].IsNewSdk -eq $true) {
|
|
||||||
Write-Host "Track 2 package info with file name $($outputPath) already exported. Skipping export."
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
$exportedPaths[$outputPath] = $pkg
|
|
||||||
|
|
||||||
SetOutput $outputPath $pkg
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Get-ChildItem -Path $outDirectory
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Write-Error "Package properties are not available for service directory $serviceDirectory or $prdiff"
|
|
||||||
exit 1
|
exit 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (-not (Test-Path -Path $outDirectory))
|
||||||
|
{
|
||||||
|
New-Item -ItemType Directory -Force -Path $outDirectory | Out-Null
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach($pkg in $allPackageProperties)
|
||||||
|
{
|
||||||
|
if ($pkg.Name) {
|
||||||
|
Write-Host "Package Name: $($pkg.Name)"
|
||||||
|
Write-Host "Package Version: $($pkg.Version)"
|
||||||
|
Write-Host "Package SDK Type: $($pkg.SdkType)"
|
||||||
|
Write-Host "Artifact Name: $($pkg.ArtifactName)"
|
||||||
|
Write-Host "Release date: $($pkg.ReleaseStatus)"
|
||||||
|
$configFilePrefix = $pkg.Name
|
||||||
|
if ($pkg.ArtifactName)
|
||||||
|
{
|
||||||
|
$configFilePrefix = $pkg.ArtifactName
|
||||||
|
}
|
||||||
|
$outputPath = Join-Path -Path $outDirectory "$configFilePrefix.json"
|
||||||
|
Write-Host "Output path of json file: $outputPath"
|
||||||
|
$outDir = Split-Path $outputPath -parent
|
||||||
|
if (-not (Test-Path -path $outDir))
|
||||||
|
{
|
||||||
|
Write-Host "Creating directory $($outDir) for json property file"
|
||||||
|
New-Item -ItemType Directory -Path $outDir | Out-Null
|
||||||
|
}
|
||||||
|
|
||||||
|
# If package properties for a track 2 (IsNewSdk = true) package has
|
||||||
|
# already been written, skip writing to that same path.
|
||||||
|
if ($exportedPaths.ContainsKey($outputPath) -and $exportedPaths[$outputPath].IsNewSdk -eq $true) {
|
||||||
|
Write-Host "Track 2 package info with file name $($outputPath) already exported. Skipping export."
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
$exportedPaths[$outputPath] = $pkg
|
||||||
|
|
||||||
|
SetOutput $outputPath $pkg
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Get-ChildItem -Path $outDirectory
|
||||||
|
|
Загрузка…
Ссылка в новой задаче