diff options
author | Sean Simmons <ssimmons@progress.com> | 2022-12-14 17:00:20 -0500 |
---|---|---|
committer | Sean Simmons <ssimmons@progress.com> | 2022-12-14 17:00:20 -0500 |
commit | 788a478eb35f47eedbc8ee022a054c82f00c86af (patch) | |
tree | 88d2a70c8f966583b42c3bd420b5000a7c1ec293 | |
parent | 0420bd683c01fe2bb04f77550ae32e7003644331 (diff) | |
download | chef-788a478eb35f47eedbc8ee022a054c82f00c86af.tar.gz |
use one script
Signed-off-by: Sean Simmons <ssimmons@progress.com>
-rw-r--r-- | .expeditor/scripts/habitat-test.ps1 | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/.expeditor/scripts/habitat-test.ps1 b/.expeditor/scripts/habitat-test.ps1 index bdb77b30b1..71d8610350 100644 --- a/.expeditor/scripts/habitat-test.ps1 +++ b/.expeditor/scripts/habitat-test.ps1 @@ -2,11 +2,28 @@ $ErrorActionPreference = "Stop" +try { + [Version]$hab_version = (hab --version).split(" ")[1].split("/")[0] + if ($hab_version -lt [Version]"0.85.0" ) { + Write-Host "--- :habicat: Installing the version of Habitat required" + Set-ExecutionPolicy Bypass -Scope Process -Force + Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/habitat-sh/habitat/main/components/hab/install.ps1')) + if (-not $?) { throw "Hab version is older than 0.85 and could not update it." } + } else { + Write-Host "--- :habicat: :thumbsup: Minimum required version of Habitat already installed" + } +} +catch { + # This install fails if Hab isn't on the path when we check for the version. This ensures it is installed + Write-Host "--- :habicat: Installing the version of Habitat required" + Set-ExecutionPolicy Bypass -Scope Process -Force + Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/habitat-sh/habitat/main/components/hab/install.ps1')) +} + function test-script { $EXPEDITOR_PKG_IDENTS_CHEFINFRACLIENTX86_64WINDOWS = 'chef/chef-infra-client/18.0.179/20221109104144' - & ((Split-Path $MyInvocation.InvocationName) + "\ensure-minimum-viable-hab.ps1") Write-Output "################ Testing EXPEDITOR_PKG_IDENTS_CHEFINFRACLIENTX86_64WINDOWS ##############" Write-Host "--- Installing $EXPEDITOR_PKG_IDENTS_CHEFINFRACLIENTX86_64WINDOWS" $env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User") |