Skip to content
10 changes: 6 additions & 4 deletions eng/scripts/Language-Settings.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -203,25 +203,27 @@ function DockerValidation{
[Parameter(Mandatory=$false)]
[string]$workingDirectory
)
$commandLine = ""
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
$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" `
$commandLine = docker run -v "${workingDirectory}:/workdir/out" `
-e TARGET_PACKAGE=$packageName -e TARGET_VERSION=$packageVersion -t $DocValidationImageId 2>&1 | Out-Null

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you want to remove the Out-Null here as well?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. That's for testing purpose.
I am kicking a pipeline.
https://dev.azure.com/azure-sdk/internal/_build/results?buildId=1276768&view=results

}
# 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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is always going to be empty because you are piping to Out-Null. You should remove the null pipe if you're capturing it in a variable to be printed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will put the message to debug level. Then, we can rerun the pipeline by turn on 'System.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."
LogWarning "Package $packageName ref docs validation failed."
return $false
}
return $true
Expand Down