Ensure locale is set correctly on Ubuntu 20.04 in CI (#16067)
This commit is contained in:
parent
af19120251
commit
2fd2dfce12
|
@ -122,6 +122,9 @@ stages:
|
|||
condition: succeededOrFailed()
|
||||
|
||||
- pwsh: |
|
||||
Import-Module .\build.psm1
|
||||
Set-CorrectLocale
|
||||
|
||||
Import-Module .\tools\ci.psm1
|
||||
Restore-PSOptions -PSOptionsPath '$(System.ArtifactsDirectory)\build\psoptions.json'
|
||||
Invoke-CITest -Purpose UnelevatedPesterTests -TagSet Others
|
||||
|
@ -129,6 +132,9 @@ stages:
|
|||
condition: succeededOrFailed()
|
||||
|
||||
- pwsh: |
|
||||
Import-Module .\build.psm1
|
||||
Set-CorrectLocale
|
||||
|
||||
Import-Module .\tools\ci.psm1
|
||||
Restore-PSOptions -PSOptionsPath '$(System.ArtifactsDirectory)\build\psoptions.json'
|
||||
Invoke-CITest -Purpose ElevatedPesterTests -TagSet Others
|
||||
|
|
|
@ -64,16 +64,7 @@ jobs:
|
|||
|
||||
- pwsh: |
|
||||
Import-Module .\build.psm1 -Force
|
||||
$environment = Get-EnvironmentInformation
|
||||
$isUbuntu20 = $environment.IsUbuntu -and $environment.IsUbuntu20
|
||||
if ($isUbuntu20) {
|
||||
$env:LC_ALL='en_US.UTF-8'
|
||||
$env:LANG='en_US.UTF-8'
|
||||
sudo locale-gen $LANG
|
||||
sudo update-locale
|
||||
}
|
||||
|
||||
locale
|
||||
Set-CorrectLocale
|
||||
|
||||
Import-Module .\tools\ci.psm1
|
||||
Restore-PSOptions -PSOptionsPath '$(System.ArtifactsDirectory)\build\psoptions.json'
|
||||
|
|
20
build.psm1
20
build.psm1
|
@ -3386,3 +3386,23 @@ function New-NugetConfigFile
|
|||
|
||||
Set-Content -Path (Join-Path $Destination 'nuget.config') -Value $content -Force
|
||||
}
|
||||
|
||||
function Set-CorrectLocale
|
||||
{
|
||||
if (-not $IsLinux)
|
||||
{
|
||||
return
|
||||
}
|
||||
|
||||
$environment = Get-EnvironmentInformation
|
||||
if ($environment.IsUbuntu -and $environment.IsUbuntu20)
|
||||
{
|
||||
$env:LC_ALL = 'en_US.UTF-8'
|
||||
$env:LANG = 'en_US.UTF-8'
|
||||
sudo locale-gen $env:LANG
|
||||
sudo update-locale
|
||||
}
|
||||
|
||||
# Output the locale to log it
|
||||
locale
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue