From 6c529624f00ab52bc840c366601023b5b6664084 Mon Sep 17 00:00:00 2001 From: Rob Holt Date: Wed, 19 Feb 2020 16:24:21 -0800 Subject: [PATCH 1/2] Install pwsh in build pool --- .vsts-ci/templates/release-general.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.vsts-ci/templates/release-general.yml b/.vsts-ci/templates/release-general.yml index fd477c057..c82a3b509 100644 --- a/.vsts-ci/templates/release-general.yml +++ b/.vsts-ci/templates/release-general.yml @@ -1,4 +1,14 @@ steps: +- powershell: | + if (Get-Command pwsh -ErrorAction Ignore) { return } + $powerShellPath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'powershell' + Invoke-WebRequest -Uri https://raw.githubusercontent.com/PowerShell/PowerShell/master/tools/install-powershell.ps1 -outfile ./install-powershell.ps1 + ./install-powershell.ps1 -Destination $powerShellPath + $vstsCommandString = "vso[task.setvariable variable=PATH]$powerShellPath;$env:PATH" + Write-Host "sending " + $vstsCommandString + Write-Host "##$vstsCommandString" + displayName: Install PowerShell Core + - pwsh: | Get-ChildItem -Path env: displayName: Capture environment From 8514a55398a03c57b2b74ce37ab10cc172dd8769 Mon Sep 17 00:00:00 2001 From: Rob Holt Date: Wed, 19 Feb 2020 16:25:39 -0800 Subject: [PATCH 2/2] Add messages --- .vsts-ci/templates/release-general.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.vsts-ci/templates/release-general.yml b/.vsts-ci/templates/release-general.yml index c82a3b509..9a76eacf0 100644 --- a/.vsts-ci/templates/release-general.yml +++ b/.vsts-ci/templates/release-general.yml @@ -1,6 +1,11 @@ steps: - powershell: | - if (Get-Command pwsh -ErrorAction Ignore) { return } + Write-Host "Installing pwsh..." + if (Get-Command pwsh -ErrorAction Ignore) + { + Write-Host "pwsh already installed, skipping" + return + } $powerShellPath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'powershell' Invoke-WebRequest -Uri https://raw.githubusercontent.com/PowerShell/PowerShell/master/tools/install-powershell.ps1 -outfile ./install-powershell.ps1 ./install-powershell.ps1 -Destination $powerShellPath