diff options
author | Robb Kidd <rkidd@chef.io> | 2020-04-25 14:34:38 -0400 |
---|---|---|
committer | Robb Kidd <rkidd@chef.io> | 2020-04-28 11:50:00 -0400 |
commit | 5f7a1dfa1a9d784f0993f1299eb888254b9d1398 (patch) | |
tree | 3f9f84e2fb02558a7ef7d821834f5da30ab35893 /scripts | |
parent | c9edf666ed038650dac66ef46256cca9217718ce (diff) | |
download | chef-5f7a1dfa1a9d784f0993f1299eb888254b9d1398.tar.gz |
improve required hab version detection
The original implementation--written by me--was incredibly naive in only
testing the minor version. This is much better in using a Version class
that knows how to compare actual version numbers.
Signed-off-by: Robb Kidd <robb@thekidds.org>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/ci/ensure-minimum-viable-hab.ps1 | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/scripts/ci/ensure-minimum-viable-hab.ps1 b/scripts/ci/ensure-minimum-viable-hab.ps1 index 175c7d4890..10bfeb0fa8 100644 --- a/scripts/ci/ensure-minimum-viable-hab.ps1 +++ b/scripts/ci/ensure-minimum-viable-hab.ps1 @@ -1,6 +1,5 @@ -$hab_version = (hab --version) -$hab_minor_version = $hab_version.split('.')[1] -if ( -not $? -Or $hab_minor_version -lt 85 ) { +[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." } |