From 6c84d23bdcfe52ac981dfff2cb505cf14efdf1b1 Mon Sep 17 00:00:00 2001 From: Christoph Bergmeister Date: Sun, 24 Jan 2021 13:09:39 +0000 Subject: [PATCH 01/13] Bootstrap dependencies in parallel in CI --- tools/appveyor.psm1 | 85 ++++++++++++++++++++++++++------------------- 1 file changed, 50 insertions(+), 35 deletions(-) diff --git a/tools/appveyor.psm1 b/tools/appveyor.psm1 index c38877643..36004b407 100644 --- a/tools/appveyor.psm1 +++ b/tools/appveyor.psm1 @@ -27,48 +27,63 @@ function Invoke-AppVeyorInstall { [switch] $SkipPesterInstallation ) - if (-not $SkipPesterInstallation.IsPresent) { Install-Pester } + $jobs = @() - if ($null -eq (Get-Module -ListAvailable PowershellGet)) { - # WMF 4 image build - Write-Verbose -Verbose "Installing platyPS via nuget" - nuget install platyPS -source https://www.powershellgallery.com/api/v2 -outputDirectory "$Env:ProgramFiles\WindowsPowerShell\Modules\." -ExcludeVersion - } - else { - Write-Verbose -Verbose "Installing platyPS via Install-Module" - Install-Module -Name platyPS -Force -Scope CurrentUser -Repository PSGallery + $jobs += { + if (-not $SkipPesterInstallation.IsPresent) { Install-Pester } } - # Do not use 'build.ps1 -bootstrap' option for bootstraping the .Net SDK as it does not work well in CI with the AppVeyor Ubuntu image - Write-Verbose -Verbose "Installing required .Net CORE SDK" - # the legacy WMF4 image only has the old preview SDKs of dotnet - $globalDotJson = Get-Content (Join-Path $PSScriptRoot '..\global.json') -Raw | ConvertFrom-Json - $requiredDotNetCoreSDKVersion = $globalDotJson.sdk.version - if ($PSVersionTable.PSVersion.Major -gt 4) { - $requiredDotNetCoreSDKVersionPresent = (dotnet --list-sdks) -match $requiredDotNetCoreSDKVersion - } - else { - # WMF 4 image has old SDK that does not have --list-sdks parameter - $requiredDotNetCoreSDKVersionPresent = (dotnet --version).StartsWith($requiredDotNetCoreSDKVersion) + $jobs += { + if ($null -eq (Get-Module -ListAvailable PowershellGet)) { + # WMF 4 image build + Write-Verbose -Verbose "Installing platyPS via nuget" + nuget install platyPS -source https://www.powershellgallery.com/api/v2 -outputDirectory "$Env:ProgramFiles\WindowsPowerShell\Modules\." -ExcludeVersion + } + else { + Write-Verbose -Verbose "Installing platyPS via Install-Module" + Install-Module -Name platyPS -Force -Scope CurrentUser -Repository PSGallery + } } - if (-not $requiredDotNetCoreSDKVersionPresent) { - Write-Verbose -Verbose "Installing required .Net CORE SDK $requiredDotNetCoreSDKVersion" - $originalSecurityProtocol = [Net.ServicePointManager]::SecurityProtocol - try { - [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12 - if ($IsLinux -or $isMacOS) { - Invoke-WebRequest 'https://dot.net/v1/dotnet-install.sh' -OutFile dotnet-install.sh - bash dotnet-install.sh --version $requiredDotNetCoreSDKVersion - [System.Environment]::SetEnvironmentVariable('PATH', "/home/appveyor/.dotnet$([System.IO.Path]::PathSeparator)$PATH") + + $jobs += { + # Do not use 'build.ps1 -bootstrap' option for bootstraping the .Net SDK as it does not work well in CI with the AppVeyor Ubuntu image + Write-Verbose -Verbose "Installing required .Net CORE SDK" + # the legacy WMF4 image only has the old preview SDKs of dotnet + $globalDotJson = Get-Content (Join-Path $PSScriptRoot '..\global.json') -Raw | ConvertFrom-Json + $requiredDotNetCoreSDKVersion = $globalDotJson.sdk.version + if ($PSVersionTable.PSVersion.Major -gt 4) { + $requiredDotNetCoreSDKVersionPresent = (dotnet --list-sdks) -match $requiredDotNetCoreSDKVersion + } + else { + # WMF 4 image has old SDK that does not have --list-sdks parameter + $requiredDotNetCoreSDKVersionPresent = (dotnet --version).StartsWith($requiredDotNetCoreSDKVersion) + } + if (-not $requiredDotNetCoreSDKVersionPresent) { + Write-Verbose -Verbose "Installing required .Net CORE SDK $requiredDotNetCoreSDKVersion" + $originalSecurityProtocol = [Net.ServicePointManager]::SecurityProtocol + try { + [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12 + if ($IsLinux -or $isMacOS) { + Invoke-WebRequest 'https://dot.net/v1/dotnet-install.sh' -OutFile dotnet-install.sh + bash dotnet-install.sh --version $requiredDotNetCoreSDKVersion + [System.Environment]::SetEnvironmentVariable('PATH', "/home/appveyor/.dotnet$([System.IO.Path]::PathSeparator)$PATH") + } + else { + Invoke-WebRequest 'https://dot.net/v1/dotnet-install.ps1' -OutFile dotnet-install.ps1 + .\dotnet-install.ps1 -Version $requiredDotNetCoreSDKVersion + } } - else { - Invoke-WebRequest 'https://dot.net/v1/dotnet-install.ps1' -OutFile dotnet-install.ps1 - .\dotnet-install.ps1 -Version $requiredDotNetCoreSDKVersion + finally { + [Net.ServicePointManager]::SecurityProtocol = $originalSecurityProtocol + Remove-Item .\dotnet-install.* } } - finally { - [Net.ServicePointManager]::SecurityProtocol = $originalSecurityProtocol - Remove-Item .\dotnet-install.* + } + + Start-Job $jobs | Wait-Job | Receive-Job + $jobs | ForEach-Object { + if ($_.State -eq 'Failed') { + throw 'Bootstrapping failed, see job logs above' } } } From 2556a3ccec11df1d48a9f886242b437e83f0fc04 Mon Sep 17 00:00:00 2001 From: Christoph Bergmeister Date: Sun, 24 Jan 2021 13:15:04 +0000 Subject: [PATCH 02/13] fix syntax --- tools/appveyor.psm1 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/appveyor.psm1 b/tools/appveyor.psm1 index 36004b407..f208f7f7f 100644 --- a/tools/appveyor.psm1 +++ b/tools/appveyor.psm1 @@ -29,11 +29,11 @@ function Invoke-AppVeyorInstall { $jobs = @() - $jobs += { + $jobs += Start-Job { if (-not $SkipPesterInstallation.IsPresent) { Install-Pester } } - $jobs += { + $jobs += Start-Job { if ($null -eq (Get-Module -ListAvailable PowershellGet)) { # WMF 4 image build Write-Verbose -Verbose "Installing platyPS via nuget" @@ -45,7 +45,7 @@ function Invoke-AppVeyorInstall { } } - $jobs += { + $jobs += Start-Job { # Do not use 'build.ps1 -bootstrap' option for bootstraping the .Net SDK as it does not work well in CI with the AppVeyor Ubuntu image Write-Verbose -Verbose "Installing required .Net CORE SDK" # the legacy WMF4 image only has the old preview SDKs of dotnet @@ -80,7 +80,7 @@ function Invoke-AppVeyorInstall { } } - Start-Job $jobs | Wait-Job | Receive-Job + Wait-Job $jobs | Receive-Job $jobs | ForEach-Object { if ($_.State -eq 'Failed') { throw 'Bootstrapping failed, see job logs above' From 5eceb86f81ac5a08dcdf9c0fd5b3887cae47d510 Mon Sep 17 00:00:00 2001 From: Christoph Bergmeister Date: Sun, 24 Jan 2021 13:21:30 +0000 Subject: [PATCH 03/13] fix function scope --- tools/appveyor.psm1 | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tools/appveyor.psm1 b/tools/appveyor.psm1 index f208f7f7f..88e4318a1 100644 --- a/tools/appveyor.psm1 +++ b/tools/appveyor.psm1 @@ -29,9 +29,7 @@ function Invoke-AppVeyorInstall { $jobs = @() - $jobs += Start-Job { - if (-not $SkipPesterInstallation.IsPresent) { Install-Pester } - } + if (-not $SkipPesterInstallation.IsPresent) { $jobs += Start-Job $Function:Install-Pester } $jobs += Start-Job { if ($null -eq (Get-Module -ListAvailable PowershellGet)) { From c322aaef2ebdc33044122d9c2875de43cc5bd78c Mon Sep 17 00:00:00 2001 From: Christoph Bergmeister Date: Sun, 24 Jan 2021 13:26:23 +0000 Subject: [PATCH 04/13] using for psscriptroot --- tools/appveyor.psm1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/appveyor.psm1 b/tools/appveyor.psm1 index 88e4318a1..3c0338d6f 100644 --- a/tools/appveyor.psm1 +++ b/tools/appveyor.psm1 @@ -27,6 +27,7 @@ function Invoke-AppVeyorInstall { [switch] $SkipPesterInstallation ) + Write-Verbose -Verbose "Bootstrapping build dependencies" $jobs = @() if (-not $SkipPesterInstallation.IsPresent) { $jobs += Start-Job $Function:Install-Pester } @@ -47,7 +48,7 @@ function Invoke-AppVeyorInstall { # Do not use 'build.ps1 -bootstrap' option for bootstraping the .Net SDK as it does not work well in CI with the AppVeyor Ubuntu image Write-Verbose -Verbose "Installing required .Net CORE SDK" # the legacy WMF4 image only has the old preview SDKs of dotnet - $globalDotJson = Get-Content (Join-Path $PSScriptRoot '..\global.json') -Raw | ConvertFrom-Json + $globalDotJson = Get-Content (Join-Path $using:PSScriptRoot '..\global.json') -Raw | ConvertFrom-Json $requiredDotNetCoreSDKVersion = $globalDotJson.sdk.version if ($PSVersionTable.PSVersion.Major -gt 4) { $requiredDotNetCoreSDKVersionPresent = (dotnet --list-sdks) -match $requiredDotNetCoreSDKVersion From e64de8e604af3fb059f7b664b31fa029dc141e59 Mon Sep 17 00:00:00 2001 From: Christoph Bergmeister Date: Sun, 24 Jan 2021 13:48:45 +0000 Subject: [PATCH 05/13] add debugging statements --- tools/appveyor.psm1 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/appveyor.psm1 b/tools/appveyor.psm1 index 3c0338d6f..613737d12 100644 --- a/tools/appveyor.psm1 +++ b/tools/appveyor.psm1 @@ -30,8 +30,10 @@ function Invoke-AppVeyorInstall { Write-Verbose -Verbose "Bootstrapping build dependencies" $jobs = @() + Write-Verbose -Verbose "test1" if (-not $SkipPesterInstallation.IsPresent) { $jobs += Start-Job $Function:Install-Pester } + Write-Verbose -Verbose "test2" $jobs += Start-Job { if ($null -eq (Get-Module -ListAvailable PowershellGet)) { # WMF 4 image build @@ -44,6 +46,7 @@ function Invoke-AppVeyorInstall { } } + Write-Verbose -Verbose "test3" $jobs += Start-Job { # Do not use 'build.ps1 -bootstrap' option for bootstraping the .Net SDK as it does not work well in CI with the AppVeyor Ubuntu image Write-Verbose -Verbose "Installing required .Net CORE SDK" From 584e8f6b6bd1fb3a48192d7bb116bc2534b63683 Mon Sep 17 00:00:00 2001 From: Christoph Bergmeister Date: Sun, 24 Jan 2021 13:56:09 +0000 Subject: [PATCH 06/13] add more logging and try fix wmf param ayntax --- tools/appveyor.psm1 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/appveyor.psm1 b/tools/appveyor.psm1 index 613737d12..e23438168 100644 --- a/tools/appveyor.psm1 +++ b/tools/appveyor.psm1 @@ -17,6 +17,7 @@ function Install-Pester { Write-Verbose -Verbose "Installing Pester via Install-Module" Install-Module -Name Pester -Force -SkipPublisherCheck -Scope CurrentUser -Repository PSGallery } + Write-Verbose -Verbose "Installed Pester" } } @@ -31,7 +32,7 @@ function Invoke-AppVeyorInstall { $jobs = @() Write-Verbose -Verbose "test1" - if (-not $SkipPesterInstallation.IsPresent) { $jobs += Start-Job $Function:Install-Pester } + if (-not $SkipPesterInstallation.IsPresent) { $jobs += Start-Job -ScriptBlock $Function:Install-Pester } Write-Verbose -Verbose "test2" $jobs += Start-Job { @@ -44,6 +45,7 @@ function Invoke-AppVeyorInstall { Write-Verbose -Verbose "Installing platyPS via Install-Module" Install-Module -Name platyPS -Force -Scope CurrentUser -Repository PSGallery } + Write-Verbose -Verbose "Installed platyPS" } Write-Verbose -Verbose "test3" @@ -79,6 +81,7 @@ function Invoke-AppVeyorInstall { [Net.ServicePointManager]::SecurityProtocol = $originalSecurityProtocol Remove-Item .\dotnet-install.* } + Write-Verbose -Verbose "Installed required .Net CORE SDK" } } From f20bf3ee2f35edec1941b949cd32d97a320e260b Mon Sep 17 00:00:00 2001 From: Christoph Bergmeister Date: Sun, 24 Jan 2021 14:00:57 +0000 Subject: [PATCH 07/13] try fix wmf syntax --- tools/appveyor.psm1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/appveyor.psm1 b/tools/appveyor.psm1 index e23438168..c216a4784 100644 --- a/tools/appveyor.psm1 +++ b/tools/appveyor.psm1 @@ -32,7 +32,7 @@ function Invoke-AppVeyorInstall { $jobs = @() Write-Verbose -Verbose "test1" - if (-not $SkipPesterInstallation.IsPresent) { $jobs += Start-Job -ScriptBlock $Function:Install-Pester } + if (-not $SkipPesterInstallation.IsPresent) { $jobs += Start-Job -ScriptBlock ${Function:Install-Pester} } Write-Verbose -Verbose "test2" $jobs += Start-Job { From a3b41544aa42eaf9d6ffe9fdfab45e0a15bf8232 Mon Sep 17 00:00:00 2001 From: Christoph Bergmeister Date: Sun, 24 Jan 2021 14:05:42 +0000 Subject: [PATCH 08/13] try simplify --- tools/appveyor.psm1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/appveyor.psm1 b/tools/appveyor.psm1 index c216a4784..9469a10b6 100644 --- a/tools/appveyor.psm1 +++ b/tools/appveyor.psm1 @@ -32,7 +32,7 @@ function Invoke-AppVeyorInstall { $jobs = @() Write-Verbose -Verbose "test1" - if (-not $SkipPesterInstallation.IsPresent) { $jobs += Start-Job -ScriptBlock ${Function:Install-Pester} } + if (-not $SkipPesterInstallation.IsPresent) { $jobs += Start-Job ${Function:Install-Pester} } Write-Verbose -Verbose "test2" $jobs += Start-Job { From 8a52f3bb8b0bacb381c81be1ea420bfb3ad793e4 Mon Sep 17 00:00:00 2001 From: Christoph Bergmeister Date: Sun, 24 Jan 2021 18:22:23 +0000 Subject: [PATCH 09/13] set env outside psjob --- tools/appveyor.psm1 | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/tools/appveyor.psm1 b/tools/appveyor.psm1 index 9469a10b6..601a6a571 100644 --- a/tools/appveyor.psm1 +++ b/tools/appveyor.psm1 @@ -17,7 +17,7 @@ function Install-Pester { Write-Verbose -Verbose "Installing Pester via Install-Module" Install-Module -Name Pester -Force -SkipPublisherCheck -Scope CurrentUser -Repository PSGallery } - Write-Verbose -Verbose "Installed Pester" + Write-Verbose -Verbose 'Installed Pester' } } @@ -28,13 +28,11 @@ function Invoke-AppVeyorInstall { [switch] $SkipPesterInstallation ) - Write-Verbose -Verbose "Bootstrapping build dependencies" + Write-Verbose -Verbose 'Bootstrapping build dependencies' $jobs = @() - Write-Verbose -Verbose "test1" if (-not $SkipPesterInstallation.IsPresent) { $jobs += Start-Job ${Function:Install-Pester} } - Write-Verbose -Verbose "test2" $jobs += Start-Job { if ($null -eq (Get-Module -ListAvailable PowershellGet)) { # WMF 4 image build @@ -45,10 +43,9 @@ function Invoke-AppVeyorInstall { Write-Verbose -Verbose "Installing platyPS via Install-Module" Install-Module -Name platyPS -Force -Scope CurrentUser -Repository PSGallery } - Write-Verbose -Verbose "Installed platyPS" + Write-Verbose -Verbose 'Installed platyPS' } - Write-Verbose -Verbose "test3" $jobs += Start-Job { # Do not use 'build.ps1 -bootstrap' option for bootstraping the .Net SDK as it does not work well in CI with the AppVeyor Ubuntu image Write-Verbose -Verbose "Installing required .Net CORE SDK" @@ -70,7 +67,6 @@ function Invoke-AppVeyorInstall { if ($IsLinux -or $isMacOS) { Invoke-WebRequest 'https://dot.net/v1/dotnet-install.sh' -OutFile dotnet-install.sh bash dotnet-install.sh --version $requiredDotNetCoreSDKVersion - [System.Environment]::SetEnvironmentVariable('PATH', "/home/appveyor/.dotnet$([System.IO.Path]::PathSeparator)$PATH") } else { Invoke-WebRequest 'https://dot.net/v1/dotnet-install.ps1' -OutFile dotnet-install.ps1 @@ -81,9 +77,11 @@ function Invoke-AppVeyorInstall { [Net.ServicePointManager]::SecurityProtocol = $originalSecurityProtocol Remove-Item .\dotnet-install.* } - Write-Verbose -Verbose "Installed required .Net CORE SDK" + Write-Verbose -Verbose 'Installed required .Net CORE SDK' } } + # Set PATH variable (which has to happen outside of a PSJob) + [System.Environment]::SetEnvironmentVariable('PATH', "/home/appveyor/.dotnet$([System.IO.Path]::PathSeparator)$PATH") Wait-Job $jobs | Receive-Job $jobs | ForEach-Object { From 5ffd45aada6f11367eb6ef31c786ba86f46dc0fe Mon Sep 17 00:00:00 2001 From: Christoph Bergmeister Date: Sun, 24 Jan 2021 18:33:58 +0000 Subject: [PATCH 10/13] only do psmodules as jobs --- tools/appveyor.psm1 | 75 +++++++++++++++++++++------------------------ 1 file changed, 35 insertions(+), 40 deletions(-) diff --git a/tools/appveyor.psm1 b/tools/appveyor.psm1 index 601a6a571..f243322ce 100644 --- a/tools/appveyor.psm1 +++ b/tools/appveyor.psm1 @@ -28,12 +28,10 @@ function Invoke-AppVeyorInstall { [switch] $SkipPesterInstallation ) - Write-Verbose -Verbose 'Bootstrapping build dependencies' - $jobs = @() + $installPowerShellModulesjobs = @() + if (-not $SkipPesterInstallation.IsPresent) { $installPowerShellModulesjobs += Start-Job ${Function:Install-Pester} } - if (-not $SkipPesterInstallation.IsPresent) { $jobs += Start-Job ${Function:Install-Pester} } - - $jobs += Start-Job { + $installPowerShellModulesjobs += Start-Job { if ($null -eq (Get-Module -ListAvailable PowershellGet)) { # WMF 4 image build Write-Verbose -Verbose "Installing platyPS via nuget" @@ -46,47 +44,44 @@ function Invoke-AppVeyorInstall { Write-Verbose -Verbose 'Installed platyPS' } - $jobs += Start-Job { - # Do not use 'build.ps1 -bootstrap' option for bootstraping the .Net SDK as it does not work well in CI with the AppVeyor Ubuntu image - Write-Verbose -Verbose "Installing required .Net CORE SDK" - # the legacy WMF4 image only has the old preview SDKs of dotnet - $globalDotJson = Get-Content (Join-Path $using:PSScriptRoot '..\global.json') -Raw | ConvertFrom-Json - $requiredDotNetCoreSDKVersion = $globalDotJson.sdk.version - if ($PSVersionTable.PSVersion.Major -gt 4) { - $requiredDotNetCoreSDKVersionPresent = (dotnet --list-sdks) -match $requiredDotNetCoreSDKVersion - } - else { - # WMF 4 image has old SDK that does not have --list-sdks parameter - $requiredDotNetCoreSDKVersionPresent = (dotnet --version).StartsWith($requiredDotNetCoreSDKVersion) - } - if (-not $requiredDotNetCoreSDKVersionPresent) { - Write-Verbose -Verbose "Installing required .Net CORE SDK $requiredDotNetCoreSDKVersion" - $originalSecurityProtocol = [Net.ServicePointManager]::SecurityProtocol - try { - [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12 - if ($IsLinux -or $isMacOS) { - Invoke-WebRequest 'https://dot.net/v1/dotnet-install.sh' -OutFile dotnet-install.sh - bash dotnet-install.sh --version $requiredDotNetCoreSDKVersion - } - else { - Invoke-WebRequest 'https://dot.net/v1/dotnet-install.ps1' -OutFile dotnet-install.ps1 - .\dotnet-install.ps1 -Version $requiredDotNetCoreSDKVersion - } + # Do not use 'build.ps1 -bootstrap' option for bootstraping the .Net SDK as it does not work well in CI with the AppVeyor Ubuntu image + Write-Verbose -Verbose "Installing required .Net CORE SDK" + # the legacy WMF4 image only has the old preview SDKs of dotnet + $globalDotJson = Get-Content (Join-Path $using:PSScriptRoot '..\global.json') -Raw | ConvertFrom-Json + $requiredDotNetCoreSDKVersion = $globalDotJson.sdk.version + if ($PSVersionTable.PSVersion.Major -gt 4) { + $requiredDotNetCoreSDKVersionPresent = (dotnet --list-sdks) -match $requiredDotNetCoreSDKVersion + } + else { + # WMF 4 image has old SDK that does not have --list-sdks parameter + $requiredDotNetCoreSDKVersionPresent = (dotnet --version).StartsWith($requiredDotNetCoreSDKVersion) + } + if (-not $requiredDotNetCoreSDKVersionPresent) { + Write-Verbose -Verbose "Installing required .Net CORE SDK $requiredDotNetCoreSDKVersion" + $originalSecurityProtocol = [Net.ServicePointManager]::SecurityProtocol + try { + [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12 + if ($IsLinux -or $isMacOS) { + Invoke-WebRequest 'https://dot.net/v1/dotnet-install.sh' -OutFile dotnet-install.sh + bash dotnet-install.sh --version $requiredDotNetCoreSDKVersion + [System.Environment]::SetEnvironmentVariable('PATH', "/home/appveyor/.dotnet$([System.IO.Path]::PathSeparator)$PATH") } - finally { - [Net.ServicePointManager]::SecurityProtocol = $originalSecurityProtocol - Remove-Item .\dotnet-install.* + else { + Invoke-WebRequest 'https://dot.net/v1/dotnet-install.ps1' -OutFile dotnet-install.ps1 + .\dotnet-install.ps1 -Version $requiredDotNetCoreSDKVersion } - Write-Verbose -Verbose 'Installed required .Net CORE SDK' } + finally { + [Net.ServicePointManager]::SecurityProtocol = $originalSecurityProtocol + Remove-Item .\dotnet-install.* + } + Write-Verbose -Verbose 'Installed required .Net CORE SDK' } - # Set PATH variable (which has to happen outside of a PSJob) - [System.Environment]::SetEnvironmentVariable('PATH', "/home/appveyor/.dotnet$([System.IO.Path]::PathSeparator)$PATH") - Wait-Job $jobs | Receive-Job - $jobs | ForEach-Object { + Wait-Job $installPowerShellModulesjobs | Receive-Job + $installPowerShellModulesjobs | ForEach-Object { if ($_.State -eq 'Failed') { - throw 'Bootstrapping failed, see job logs above' + throw 'Installing PowerShell modules failed, see job logs above' } } } From 0d5f765fc0ddcf11b5adb49d52dfa3fe1b8eabfa Mon Sep 17 00:00:00 2001 From: Christoph Bergmeister Date: Sun, 24 Jan 2021 18:39:18 +0000 Subject: [PATCH 11/13] fix and shallow fetch --- .azure-pipelines-ci/ci.yaml | 2 ++ tools/appveyor.psm1 | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.azure-pipelines-ci/ci.yaml b/.azure-pipelines-ci/ci.yaml index 7cf89937a..b55a89f74 100644 --- a/.azure-pipelines-ci/ci.yaml +++ b/.azure-pipelines-ci/ci.yaml @@ -9,6 +9,8 @@ stages: pool: vmImage: windows-latest steps: + - checkout: self + fetchDepth: 1 - pwsh: | Import-Module .\tools\appveyor.psm1 Invoke-AppveyorInstall -SkipPesterInstallation diff --git a/tools/appveyor.psm1 b/tools/appveyor.psm1 index f243322ce..b173d0c8e 100644 --- a/tools/appveyor.psm1 +++ b/tools/appveyor.psm1 @@ -47,7 +47,7 @@ function Invoke-AppVeyorInstall { # Do not use 'build.ps1 -bootstrap' option for bootstraping the .Net SDK as it does not work well in CI with the AppVeyor Ubuntu image Write-Verbose -Verbose "Installing required .Net CORE SDK" # the legacy WMF4 image only has the old preview SDKs of dotnet - $globalDotJson = Get-Content (Join-Path $using:PSScriptRoot '..\global.json') -Raw | ConvertFrom-Json + $globalDotJson = Get-Content (Join-Path $PSScriptRoot '..\global.json') -Raw | ConvertFrom-Json $requiredDotNetCoreSDKVersion = $globalDotJson.sdk.version if ($PSVersionTable.PSVersion.Major -gt 4) { $requiredDotNetCoreSDKVersionPresent = (dotnet --list-sdks) -match $requiredDotNetCoreSDKVersion From 32537f55736adf384a60308740f145c268de22dc Mon Sep 17 00:00:00 2001 From: Christoph Bergmeister Date: Sun, 24 Jan 2021 18:43:38 +0000 Subject: [PATCH 12/13] shallow fetch for tests as well --- .azure-pipelines-ci/ci.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.azure-pipelines-ci/ci.yaml b/.azure-pipelines-ci/ci.yaml index b55a89f74..cd13c3d74 100644 --- a/.azure-pipelines-ci/ci.yaml +++ b/.azure-pipelines-ci/ci.yaml @@ -10,7 +10,7 @@ stages: vmImage: windows-latest steps: - checkout: self - fetchDepth: 1 + fetchDepth: 5 - pwsh: | Import-Module .\tools\appveyor.psm1 Invoke-AppveyorInstall -SkipPesterInstallation @@ -52,4 +52,6 @@ stages: pool: vmImage: $[ variables['vmImage'] ] steps: + - checkout: self + fetchDepth: 5 - template: templates/test-powershell.yaml From 3fe37c66f886a78e22757fa2820d5bb18ea22256 Mon Sep 17 00:00:00 2001 From: Christoph Bergmeister Date: Sun, 24 Jan 2021 18:47:59 +0000 Subject: [PATCH 13/13] undo shallow fetch as it made no difference --- .azure-pipelines-ci/ci.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.azure-pipelines-ci/ci.yaml b/.azure-pipelines-ci/ci.yaml index cd13c3d74..7cf89937a 100644 --- a/.azure-pipelines-ci/ci.yaml +++ b/.azure-pipelines-ci/ci.yaml @@ -9,8 +9,6 @@ stages: pool: vmImage: windows-latest steps: - - checkout: self - fetchDepth: 5 - pwsh: | Import-Module .\tools\appveyor.psm1 Invoke-AppveyorInstall -SkipPesterInstallation @@ -52,6 +50,4 @@ stages: pool: vmImage: $[ variables['vmImage'] ] steps: - - checkout: self - fetchDepth: 5 - template: templates/test-powershell.yaml