diff options
author | neha-p6 <neha.pansare@progress.com> | 2022-10-27 17:54:48 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-27 17:54:48 +0530 |
commit | 44c09fd8f3149715f297dc9ddea6b52e3ed8343a (patch) | |
tree | 6489572aa8707b69b3ba57ee6f809eb457c0225f | |
parent | 962ec88d397420b0d8bf388f6ecc32d8cbbef2ef (diff) | |
download | chef-44c09fd8f3149715f297dc9ddea6b52e3ed8343a.tar.gz |
[chef-16] Fix hab package failures under windows plan in verify pipeline (#13251)
* Fix 'Hab version is older than 0.85 and could not update it.' error in windows plan in verify pipeline
* Fix 'The term 'hab' is not recognized as the name of a cmdlet' erros under windows plan in verify pipeline by reloading git path
Signed-off-by: Neha Pansare <neha.pansare@progress.com>
-rw-r--r-- | .expeditor/scripts/ensure-minimum-viable-hab.ps1 | 3 | ||||
-rw-r--r-- | .expeditor/scripts/verify-plan.ps1 | 11 |
2 files changed, 13 insertions, 1 deletions
diff --git a/.expeditor/scripts/ensure-minimum-viable-hab.ps1 b/.expeditor/scripts/ensure-minimum-viable-hab.ps1 index 10bfeb0fa8..716de60cf8 100644 --- a/.expeditor/scripts/ensure-minimum-viable-hab.ps1 +++ b/.expeditor/scripts/ensure-minimum-viable-hab.ps1 @@ -1,7 +1,8 @@ [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 + 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" diff --git a/.expeditor/scripts/verify-plan.ps1 b/.expeditor/scripts/verify-plan.ps1 index 614d472964..6fc0633f8c 100644 --- a/.expeditor/scripts/verify-plan.ps1 +++ b/.expeditor/scripts/verify-plan.ps1 @@ -15,6 +15,17 @@ Write-Host "--- :8ball: :windows: Verifying $Plan" powershell -File "./.expeditor/scripts/ensure-minimum-viable-hab.ps1" if (-not $?) { throw "Could not ensure the minimum hab version required is installed." } +# Do this to fix 'The term "hab" is not recognized as the name of a cmdlet' errors in windows_plan under verify pipeline. +$env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User") +Write-Host "--- :construction: Verifying Git is Installed" +$source = Get-Command -Name Git -Verbose +Write-Host "Which version of Git is installed? - " $source.version +if (-not ($source.name -match "git.exe")) { + choco install git -y + # gotta refresh the path so you can actually use Git now + $env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User") +} + Write-Host "--- :key: Generating fake origin key" hab origin key generate $env:HAB_ORIGIN |