Update Ubuntu images to use Ubuntu 20.04 (#15906)
This commit is contained in:
parent
fa50e4dcae
commit
3bb6b2736a
|
@ -47,7 +47,7 @@ stages:
|
|||
jobs:
|
||||
- template: templates/ci-build.yml
|
||||
parameters:
|
||||
pool: ubuntu-16.04
|
||||
pool: ubuntu-20.04
|
||||
jobName: linux_build
|
||||
displayName: linux Build
|
||||
|
||||
|
@ -56,7 +56,7 @@ stages:
|
|||
jobs:
|
||||
- job: linux_test
|
||||
pool:
|
||||
vmImage: ubuntu-16.04
|
||||
vmImage: ubuntu-20.04
|
||||
displayName: Linux Test
|
||||
|
||||
steps:
|
||||
|
@ -149,7 +149,7 @@ stages:
|
|||
- job: CodeCovTestPackage
|
||||
displayName: CodeCoverage and Test Packages
|
||||
pool:
|
||||
vmImage: ubuntu-16.04
|
||||
vmImage: ubuntu-20.04
|
||||
steps:
|
||||
- pwsh: |
|
||||
Import-Module .\tools\ci.psm1
|
||||
|
|
|
@ -52,7 +52,7 @@ stages:
|
|||
jobs:
|
||||
- template: templates/ci-build.yml
|
||||
parameters:
|
||||
pool: ubuntu-16.04
|
||||
pool: ubuntu-20.04
|
||||
jobName: linux_build
|
||||
displayName: linux Build
|
||||
|
||||
|
@ -62,34 +62,34 @@ stages:
|
|||
- template: templates/nix-test.yml
|
||||
parameters:
|
||||
name: Linux
|
||||
pool: ubuntu-16.04
|
||||
pool: ubuntu-20.04
|
||||
purpose: UnelevatedPesterTests
|
||||
tagSet: CI
|
||||
|
||||
- template: templates/nix-test.yml
|
||||
parameters:
|
||||
name: Linux
|
||||
pool: ubuntu-16.04
|
||||
pool: ubuntu-20.04
|
||||
purpose: ElevatedPesterTests
|
||||
tagSet: CI
|
||||
|
||||
- template: templates/nix-test.yml
|
||||
parameters:
|
||||
name: Linux
|
||||
pool: ubuntu-16.04
|
||||
pool: ubuntu-20.04
|
||||
purpose: UnelevatedPesterTests
|
||||
tagSet: Others
|
||||
|
||||
- template: templates/nix-test.yml
|
||||
parameters:
|
||||
name: Linux
|
||||
pool: ubuntu-16.04
|
||||
pool: ubuntu-20.04
|
||||
purpose: ElevatedPesterTests
|
||||
tagSet: Others
|
||||
|
||||
- template: templates/verify-xunit.yml
|
||||
parameters:
|
||||
pool: ubuntu-16.04
|
||||
pool: ubuntu-20.04
|
||||
|
||||
- stage: PackageLinux
|
||||
displayName: Package Linux
|
||||
|
@ -97,7 +97,7 @@ stages:
|
|||
jobs:
|
||||
- template: linux/templates/packaging.yml
|
||||
parameters:
|
||||
pool: ubuntu-16.04
|
||||
pool: ubuntu-20.04
|
||||
|
||||
- stage: CodeCovTestPackage
|
||||
displayName: CodeCoverage and Test Packages
|
||||
|
@ -106,7 +106,7 @@ stages:
|
|||
- job: CodeCovTestPackage
|
||||
displayName: CodeCoverage and Test Packages
|
||||
pool:
|
||||
vmImage: ubuntu-16.04
|
||||
vmImage: ubuntu-20.04
|
||||
steps:
|
||||
- pwsh: |
|
||||
Import-Module .\tools\ci.psm1
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
parameters:
|
||||
pool: 'ubuntu-16.04'
|
||||
pool: 'ubuntu-20.04'
|
||||
parentJobs: []
|
||||
name: 'Linux'
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ jobs:
|
|||
displayName: Markdown and Common Tests
|
||||
|
||||
pool:
|
||||
vmImage: ubuntu-16.04
|
||||
vmImage: ubuntu-20.04
|
||||
|
||||
variables:
|
||||
- name: repoPath
|
||||
|
|
|
@ -63,6 +63,18 @@ jobs:
|
|||
continueOnError: true
|
||||
|
||||
- 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
|
||||
|
||||
Import-Module .\tools\ci.psm1
|
||||
Restore-PSOptions -PSOptionsPath '$(System.ArtifactsDirectory)\build\psoptions.json'
|
||||
$options = (Get-PSOptions)
|
||||
|
|
25
build.psm1
25
build.psm1
|
@ -1223,7 +1223,13 @@ function Start-PSPester {
|
|||
|
||||
if ($Unelevate)
|
||||
{
|
||||
$outputBufferFilePath = [System.IO.Path]::GetTempFileName()
|
||||
if ($environment.IsWindows) {
|
||||
$outputBufferFilePath = [System.IO.Path]::GetTempFileName()
|
||||
}
|
||||
else {
|
||||
# Azure DevOps agents do not have Temp folder setup on Ubuntu 20.04, hence using HOME directory
|
||||
$outputBufferFilePath = (Join-Path $env:HOME $([System.IO.Path]::GetRandomFileName()))
|
||||
}
|
||||
}
|
||||
|
||||
$command += "Invoke-Pester "
|
||||
|
@ -1305,7 +1311,14 @@ function Start-PSPester {
|
|||
|
||||
$PSFlags = @("-noprofile")
|
||||
if (-not [string]::IsNullOrEmpty($ExperimentalFeatureName)) {
|
||||
$configFile = [System.IO.Path]::GetTempFileName()
|
||||
|
||||
if ($environment.IsWindows) {
|
||||
$configFile = [System.IO.Path]::GetTempFileName()
|
||||
}
|
||||
else {
|
||||
$configFile = (Join-Path $env:HOME $([System.IO.Path]::GetRandomFileName()))
|
||||
}
|
||||
|
||||
$configFile = [System.IO.Path]::ChangeExtension($configFile, ".json")
|
||||
|
||||
## Create the config.json file to enable the given experimental feature.
|
||||
|
@ -1384,7 +1397,13 @@ function Start-PSPester {
|
|||
{
|
||||
if ($PassThru.IsPresent)
|
||||
{
|
||||
$passThruFile = [System.IO.Path]::GetTempFileName()
|
||||
if ($environment.IsWindows) {
|
||||
$passThruFile = [System.IO.Path]::GetTempFileName()
|
||||
}
|
||||
else {
|
||||
$passThruFile = Join-Path $env:HOME $([System.IO.Path]::GetRandomFileName())
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$command += "| Export-Clixml -Path '$passThruFile' -Force"
|
||||
|
|
|
@ -168,7 +168,13 @@ Describe "Custom type conversion in parameter binding" -Tags 'Feature' {
|
|||
}
|
||||
}
|
||||
'@
|
||||
$asmFile = [System.IO.Path]::GetTempFileName() + ".dll"
|
||||
if ($IsWindows) {
|
||||
$asmFile = [System.IO.Path]::GetTempFileName() + ".dll"
|
||||
}
|
||||
else {
|
||||
$asmFile = (Join-Path $env:HOME $([System.IO.Path]::GetRandomFileName() + ".dll"))
|
||||
}
|
||||
|
||||
Add-Type -TypeDefinition $code -OutputAssembly $asmFile
|
||||
|
||||
## Helper function to execute script
|
||||
|
|
|
@ -180,7 +180,12 @@ Describe 'get-help HelpFunc1' -Tags "Feature" {
|
|||
Describe 'get-help file' -Tags "CI" {
|
||||
BeforeAll {
|
||||
try {
|
||||
$tmpfile = [IO.Path]::ChangeExtension([IO.Path]::GetTempFileName(), "ps1")
|
||||
if ($IsWindows) {
|
||||
$tmpfile = [IO.Path]::ChangeExtension([IO.Path]::GetTempFileName(), "ps1")
|
||||
}
|
||||
else {
|
||||
$tmpfile = Join-Path $env:HOME $([IO.Path]::ChangeExtension([IO.Path]::GetRandomFileName(), "ps1"))
|
||||
}
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
|
@ -233,7 +238,12 @@ Describe 'get-help file' -Tags "CI" {
|
|||
Describe 'get-help other tests' -Tags "CI" {
|
||||
BeforeAll {
|
||||
try {
|
||||
$tempFile = [IO.Path]::ChangeExtension([IO.Path]::GetTempFileName(), "ps1")
|
||||
if ($IsWindows) {
|
||||
$tempFile = [IO.Path]::ChangeExtension([IO.Path]::GetTempFileName(), "ps1")
|
||||
}
|
||||
else {
|
||||
$tempFile = Join-Path $env:HOME $([IO.Path]::ChangeExtension([IO.Path]::GetRandomFileName(), "ps1"))
|
||||
}
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
|
|
|
@ -96,7 +96,8 @@ Describe "Test-Connection" -tags "CI" {
|
|||
{ Test-Connection "fakeHost" -Count 1 -ErrorAction Stop } |
|
||||
Should -Throw -ErrorId "TestConnectionException,Microsoft.PowerShell.Commands.TestConnectionCommand"
|
||||
# Error code = 11001 - Host not found.
|
||||
if ((Get-PlatformInfo).Platform -match "raspbian") {
|
||||
$platform = Get-PlatformInfo
|
||||
if ($platform.Platform -match "raspbian" -or ( $platform.Platform -match 'ubuntu' -and $platform.Version -eq '20.04')) {
|
||||
$code = 11
|
||||
} elseif (!$IsWindows) {
|
||||
$code = -131073
|
||||
|
|
|
@ -155,7 +155,13 @@ public class SMAAttributeTest$guid : PSCmdlet
|
|||
|
||||
## The assembly files cannot be removed once they are loaded, unless the current PowerShell session exits.
|
||||
## If we use $TestDrive here, then Pester will try to remove them afterward and result in errors.
|
||||
$TempPath = [System.IO.Path]::GetTempFileName()
|
||||
if ($IsWindows) {
|
||||
$TempPath = [System.IO.Path]::GetTempFileName()
|
||||
}
|
||||
else {
|
||||
$TempPath = (Join-Path $env:HOME $([System.IO.Path]::GetRandomFileName()))
|
||||
}
|
||||
|
||||
if (Test-Path $TempPath) { Remove-Item -Path $TempPath -Force -Recurse }
|
||||
New-Item -Path $TempPath -ItemType Directory -Force > $null
|
||||
|
||||
|
|
|
@ -154,7 +154,14 @@ set-psbreakpoint -command foo
|
|||
}
|
||||
|
||||
It "Fail to set psbreakpoints when script is a file of wrong type" {
|
||||
$tempFile = [System.IO.Path]::GetTempFileName()
|
||||
|
||||
if ($IsWindows) {
|
||||
$tempFile = [System.IO.Path]::GetTempFileName()
|
||||
}
|
||||
else {
|
||||
$tempFile = (Join-Path $env:HOME $([System.IO.Path]::GetRandomFileName()))
|
||||
}
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
{
|
||||
Set-PSBreakpoint -Script $tempFile -Line 1
|
||||
|
|
|
@ -35,7 +35,14 @@ Describe "Assembly.LoadFrom Validation Test" -Tags "CI" {
|
|||
|
||||
## The assembly files cannot be removed once they are loaded, unless the current PowerShell session exits.
|
||||
## If we use $TestDrive here, then Pester will try to remove them afterward and result in errors.
|
||||
$TempPath = [System.IO.Path]::GetTempFileName()
|
||||
|
||||
if ($IsWindows) {
|
||||
$TempPath = [System.IO.Path]::GetTempFileName()
|
||||
}
|
||||
else {
|
||||
$TempPath = (Join-Path $env:HOME $([System.IO.Path]::GetRandomFileName()))
|
||||
}
|
||||
|
||||
if (Test-Path $TempPath) { Remove-Item -Path $TempPath -Force -Recurse }
|
||||
New-Item -Path $TempPath -ItemType Directory -Force > $null
|
||||
|
||||
|
|
|
@ -6,7 +6,13 @@ Describe "Can load a native assembly" -Tags "CI" {
|
|||
BeforeAll {
|
||||
## The assembly files cannot be removed once they are loaded, unless the current PowerShell session exits.
|
||||
## If we use $TestDrive here, then Pester will try to remove them afterward and result in errors.
|
||||
$TempPath = [System.IO.Path]::GetTempFileName()
|
||||
if ($IsWindows) {
|
||||
$TempPath = [System.IO.Path]::GetTempFileName()
|
||||
}
|
||||
else {
|
||||
$TempPath = (Join-Path $env:HOME $([System.IO.Path]::GetRandomFileName()))
|
||||
}
|
||||
|
||||
if (Test-Path $TempPath) { Remove-Item -Path $TempPath -Force -Recurse }
|
||||
New-Item -Path $TempPath -ItemType Directory -Force > $null
|
||||
|
||||
|
|
|
@ -83,7 +83,8 @@ Describe "SkipCACheck and SkipCNCheck PSSession options are required for New-PSS
|
|||
if (
|
||||
($platformInfo.Platform -match "alpine|raspbian") -or
|
||||
($platformInfo.Platform -eq "debian" -and ($platformInfo.Version -eq '10' -or $platformInfo.Version -eq '')) -or # debian 11 has empty Version ID
|
||||
($platformInfo.Platform -eq 'centos' -and $platformInfo.Version -eq '8')
|
||||
($platformInfo.Platform -eq 'centos' -and $platformInfo.Version -eq '8') -or
|
||||
($platformInfo.Platform -eq 'ubuntu' -and $platformInfo.Version -eq '20.04')
|
||||
) {
|
||||
Set-ItResult -Skipped -Because "MI library not available for Alpine, Raspberry Pi, Debian 10 and 11, and CentOS 8"
|
||||
return
|
||||
|
|
|
@ -15,6 +15,7 @@ Describe "New-PSSession basic test" -Tag @("CI") {
|
|||
($platformInfo.Platform -match "alpine|raspbian") -or
|
||||
($platformInfo.Platform -eq "debian" -and ($platformInfo.Version -eq '10' -or $platformInfo.Version -eq '')) -or # debian 11 has empty Version ID
|
||||
($platformInfo.Platform -eq 'centos' -and $platformInfo.Version -eq '8') -or
|
||||
($platformInfo.Platform -eq 'ubuntu' -and $platformInfo.Version -eq '20.04') -or
|
||||
($IsMacOS)
|
||||
) {
|
||||
Set-ItResult -Skipped -Because "MI library not available for Alpine, Raspberry Pi, Debian 10 and 11, CentOS 8, and not compatible with macOS"
|
||||
|
@ -33,6 +34,7 @@ Describe "Basic Auth over HTTP not allowed on Unix" -Tag @("CI") {
|
|||
($platformInfo.Platform -match "alpine|raspbian") -or
|
||||
($platformInfo.Platform -eq "debian" -and ($platformInfo.Version -eq '10' -or $platformInfo.Version -eq '')) -or # debian 11 has empty Version ID
|
||||
($platformInfo.Platform -eq 'centos' -and $platformInfo.Version -eq '8') -or
|
||||
($platformInfo.Platform -eq 'ubuntu' -and $platformInfo.Version -eq '20.04') -or
|
||||
($IsMacOS)
|
||||
) {
|
||||
Set-ItResult -Skipped -Because "MI library not available for Alpine, Raspberry Pi, Debian 10 and 11, CentOS 8, and not compatible with macOS"
|
||||
|
@ -56,6 +58,7 @@ Describe "Basic Auth over HTTP not allowed on Unix" -Tag @("CI") {
|
|||
($platformInfo.Platform -match "alpine|raspbian") -or
|
||||
($platformInfo.Platform -eq "debian" -and ($platformInfo.Version -eq '10' -or $platformInfo.Version -eq '')) -or # debian 11 has empty Version ID
|
||||
($platformInfo.Platform -eq 'centos' -and $platformInfo.Version -eq '8') -or
|
||||
($platformInfo.Platform -eq 'ubuntu' -and $platformInfo.Version -eq '20.04') -or
|
||||
($IsMacOS)
|
||||
) {
|
||||
Set-ItResult -Skipped -Because "MI library not available for Alpine, Raspberry Pi, Debian 10 and 11, CentOS 8, and not compatible with macOS"
|
||||
|
|
|
@ -102,7 +102,7 @@ function Start-WebListener
|
|||
[int]$HttpPort = 8083,
|
||||
|
||||
[ValidateRange(1,65535)]
|
||||
[int]$HttpsPort = 8084,
|
||||
[int]$HttpsPort = 9084,
|
||||
|
||||
[ValidateRange(1,65535)]
|
||||
[int]$Tls11Port = 8085,
|
||||
|
|
|
@ -1351,21 +1351,21 @@ function New-AfterScripts
|
|||
Write-Verbose -Message "AfterScript Distribution: $Distribution" -Verbose
|
||||
|
||||
if ($Environment.IsRedHatFamily) {
|
||||
$AfterInstallScript = [io.path]::GetTempFileName()
|
||||
$AfterRemoveScript = [io.path]::GetTempFileName()
|
||||
$AfterInstallScript = (Join-Path $env:HOME $([System.IO.Path]::GetRandomFileName()))
|
||||
$AfterRemoveScript = (Join-Path $env:HOME $([System.IO.Path]::GetRandomFileName()))
|
||||
$packagingStrings.RedHatAfterInstallScript -f "$Link", $Destination | Out-File -FilePath $AfterInstallScript -Encoding ascii
|
||||
$packagingStrings.RedHatAfterRemoveScript -f "$Link", $Destination | Out-File -FilePath $AfterRemoveScript -Encoding ascii
|
||||
}
|
||||
elseif ($Environment.IsDebianFamily -or $Environment.IsSUSEFamily) {
|
||||
$AfterInstallScript = [io.path]::GetTempFileName()
|
||||
$AfterRemoveScript = [io.path]::GetTempFileName()
|
||||
$AfterInstallScript = (Join-Path $env:HOME $([System.IO.Path]::GetRandomFileName()))
|
||||
$AfterRemoveScript = (Join-Path $env:HOME $([System.IO.Path]::GetRandomFileName()))
|
||||
$packagingStrings.UbuntuAfterInstallScript -f "$Link", $Destination | Out-File -FilePath $AfterInstallScript -Encoding ascii
|
||||
$packagingStrings.UbuntuAfterRemoveScript -f "$Link", $Destination | Out-File -FilePath $AfterRemoveScript -Encoding ascii
|
||||
}
|
||||
elseif ($Environment.IsMacOS) {
|
||||
# NOTE: The macos pkgutil doesn't support uninstall actions so we did not implement it.
|
||||
# Handling uninstall can be done in Homebrew so we'll take advantage of that in the brew formula.
|
||||
$AfterInstallScript = [io.path]::GetTempFileName()
|
||||
$AfterInstallScript = (Join-Path $env:HOME $([System.IO.Path]::GetRandomFileName()))
|
||||
$packagingStrings.MacOSAfterInstallScript -f "$Link" | Out-File -FilePath $AfterInstallScript -Encoding ascii
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue