Skip to content
19 changes: 11 additions & 8 deletions eng/scripts/Language-Settings.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -204,24 +204,27 @@ function DockerValidation{
[string]$workingDirectory
)
if ($PackageSourceOverride) {
docker run -v "${workingDirectory}:/workdir/out" -e TARGET_PACKAGE=$packageName -e TARGET_VERSION=$packageVersion `
-e EXTRA_INDEX_URL=$PackageSourceOverride -t $DocValidationImageId 2>&1 | Out-Null
Write-Host "docker run -v ${workingDirectory}:/workdir/out -e TARGET_PACKAGE=$packageName -e TARGET_VERSION=$packageVersion -e EXTRA_INDEX_URL=$PackageSourceOverride -t $DocValidationImageId"
$commandLine = docker run -v "${workingDirectory}:/workdir/out" -e TARGET_PACKAGE=$packageName -e TARGET_VERSION=$packageVersion `
-e EXTRA_INDEX_URL=$PackageSourceOverride -t $DocValidationImageId 2>&1
}
else {
docker run -v "${workingDirectory}:/workdir/out" `
-e TARGET_PACKAGE=$packageName -e TARGET_VERSION=$packageVersion -t $DocValidationImageId 2>&1 | Out-Null
Write-Host "docker run -v ${workingDirectory}:/workdir/out -e TARGET_PACKAGE=$packageName -e TARGET_VERSION=$packageVersion -t $DocValidationImageId"
$commandLine = docker run -v "${workingDirectory}:/workdir/out" `
-e TARGET_PACKAGE=$packageName -e TARGET_VERSION=$packageVersion -t $DocValidationImageId 2>&1
}
# The docker exit codes: https://docs.docker.com/engine/reference/run/#exit-status
# If the docker failed because of docker itself instead of the application,
# we should skip the validation and keep the packages.

if ($LASTEXITCODE -eq 125 -Or $LASTEXITCODE -eq 126 -Or $LASTEXITCODE -eq 127) {
Write-Host $commandLine
$commandLine | ForEach-Object { Write-Debug $_ }
LogWarning "The `docker` command does not work with exit code $LASTEXITCODE. Fall back to npm install $packageName directly."
FallbackValidation -packageName "$packageName" -packageVersion "$packageVersion" -workingDirectory $workingDirectory -PackageSourceOverride $PackageSourceOverride
}
elseif ($LASTEXITCODE -ne 0) {
Write-Host $commandLine
LogWarning "Package $($Package.name) ref docs validation failed."
$commandLine | ForEach-Object { Write-Debug $_ }
LogWarning "Package $packageName ref docs validation failed."
return $false
}
return $true
Expand Down Expand Up @@ -566,4 +569,4 @@ function Validate-Python-DocMsPackages ($PackageInfo, $PackageSourceOverride, $D
$packageVersion = $packageInfo.Version
ValidatePackage -packageName $packageName -packageVersion $packageVersion `
-PackageSourceOverride $PackageSourceOverride -DocValidationImageId $DocValidationImageId
}
}