diff options
author | John McCrae <john.mccrae@progress.com> | 2022-10-21 12:25:03 +0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-21 12:25:03 +0600 |
commit | 2e0053655fcaebab258007ae81c8a839c44d42f9 (patch) | |
tree | 76aaaa7224030c7e9937640a02e46aa0b2d1619a | |
parent | a2f1e36b21fc8498854f8a78d0d2c248d0a32af1 (diff) | |
parent | a3c439412e1d694b37d9f1bfa1bb696102976e38 (diff) | |
download | chef-2e0053655fcaebab258007ae81c8a839c44d42f9.tar.gz |
Merge pull request #13266 from chef/jfm/chef17_hab4
-rw-r--r-- | .expeditor/scripts/ensure-minimum-viable-hab.ps1 | 23 | ||||
-rw-r--r-- | .github/workflows/kitchen.yml | 2 |
2 files changed, 17 insertions, 8 deletions
diff --git a/.expeditor/scripts/ensure-minimum-viable-hab.ps1 b/.expeditor/scripts/ensure-minimum-viable-hab.ps1 index 10bfeb0fa8..96ec67142d 100644 --- a/.expeditor/scripts/ensure-minimum-viable-hab.ps1 +++ b/.expeditor/scripts/ensure-minimum-viable-hab.ps1 @@ -1,8 +1,17 @@ -[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" - install-habitat --version 0.85.0.20190916 - 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" +try { + [Version]$hab_version = (hab --version).split(" ")[1].split("/")[0] + if ($hab_version -lt [Version]"0.85.0" ) { + Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/habitat-sh/habitat/main/components/hab/install.ps1')) + $env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User") + 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 { + Write-Host "--- :habicat: Forcing an install of habitat" + Set-ExecutionPolicy Bypass -Scope Process -Force + choco feature enable -n=allowGlobalConfirmation + choco install habitat + $env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User") + ";C:\ProgramData\Habitat\" } diff --git a/.github/workflows/kitchen.yml b/.github/workflows/kitchen.yml index 9a88eccb06..2e5d100595 100644 --- a/.github/workflows/kitchen.yml +++ b/.github/workflows/kitchen.yml @@ -19,7 +19,7 @@ jobs: - name: 'Install Chef/Ohai from Omnitruck' id: install_chef run: | - . { Invoke-WebRequest -useb https://omnitruck.chef.io/install.ps1 } | Invoke-Expression; Install-Project -project chef -channel current + . { Invoke-WebRequest -useb https://omnitruck.chef.io/install.ps1 } | Invoke-Expression; Install-Project -project chef -channel current -v 17 $env:PATH = "C:\opscode\chef\bin;C:\opscode\chef\embedded\bin;" + $env:PATH chef-client -v ohai -v |