Skip to content

Commit

Permalink
Add support for batched DocMS validation (#21483)
Browse files Browse the repository at this point in the history
  • Loading branch information
hallipr authored Apr 20, 2022
1 parent 934b543 commit 0416070
Showing 1 changed file with 32 additions and 18 deletions.
50 changes: 32 additions & 18 deletions eng/scripts/Language-Settings.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -437,26 +437,40 @@ function GetExistingPackageVersions ($PackageName, $GroupId = $null) {
}
}

function Validate-javascript-DocMsPackages ($PackageInfo, $DocRepoLocation, $DocValidationImageId) {
$fileLocation = ""
if ($PackageInfo.DevVersion -or $PackageInfo.Version -contains "beta") {
$fileLocation = (Join-Path $DocRepoLocation 'ci-configs/packages-preview.json')
if ($PackageInfo.DevVersion) {
$PackageInfo.Version = $PackageInfo.DevVersion
}
}
else {
$fileLocation = (Join-Path $DocRepoLocation 'ci-configs/packages-latest.json')
function Validate-javascript-DocMsPackages ($PackageInfo, $PackageInfos, $DocRepoLocation, $DocValidationImageId) {
if (!$PackageInfos) {
$PackageInfos = @($PackageInfo)
}

$packageConfig = Get-Content $fileLocation -Raw | ConvertFrom-Json
$outputPackage = $PackageInfo
foreach ($package in $packageConfig.npm_package_sources) {
if ($package.name -eq $PackageInfo.Name) {
$outputPackage = $package
$outputPackage.name = Get-DocsMsPackageName $package.name $PackageInfo.Version
break
$outputPackages = @()

foreach ($packageInfo in $PackageInfos)
{
$fileLocation = ""
if ($packageInfo.DevVersion -or $packageInfo.Version -contains "beta") {
$fileLocation = (Join-Path $DocRepoLocation 'ci-configs/packages-preview.json')
if ($packageInfo.DevVersion) {
$package.Version = $package.DevVersion
}
}
else {
$fileLocation = (Join-Path $DocRepoLocation 'ci-configs/packages-latest.json')
}

$packageConfig = Get-Content $fileLocation -Raw | ConvertFrom-Json

$outputPackage = $packageInfo

foreach ($package in $packageConfig.npm_package_sources) {
if ($package.name -eq $packageInfo.Name) {
$outputPackage = $package
$outputPackage.name = Get-DocsMsPackageName $package.name $packageInfo.Version
break
}
}

$outputPackages += $outputPackage
}
ValidatePackagesForDocs -packages $outputPackage -DocValidationImageId $DocValidationImageId

ValidatePackagesForDocs -packages $outputPackages -DocValidationImageId $DocValidationImageId
}

0 comments on commit 0416070

Please sign in to comment.