summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobb Kidd <robb@thekidds.org>2019-11-05 14:28:10 -0500
committerRobb Kidd <robb@thekidds.org>2019-11-05 16:45:58 -0500
commita239557f72823e92d42d9e5fb54cafd2ae5617f5 (patch)
tree4533c8d2faca0c35450d5b4aca09bdeae9489d89
parent8be16a680452d7da054a75446e64946f4f994788 (diff)
downloadchef-a239557f72823e92d42d9e5fb54cafd2ae5617f5.tar.gz
move minimum hab check/install to a reusable script
And use it in both the verify/habitat and habitat/test pipelines. verify/habitat needs hab >= 0.85 to both build with environment variables that don't include the studio path[1] and to binlink the runtime with stubs that include the package and system environment.[2] habitat/test needs hab >= 0.85 to binlink the runtime with stubs that include the package and system environment. [1] https://github.com/habitat-sh/habitat/pull/6850 [2] https://github.com/habitat-sh/habitat/pull/6826 Signed-off-by: Robb Kidd <robb@thekidds.org>
-rw-r--r--.expeditor/habitat-test.pipeline.yml2
-rw-r--r--scripts/ci/ensure-minimum-viable-hab.ps19
-rw-r--r--scripts/ci/verify-plan.ps112
3 files changed, 13 insertions, 10 deletions
diff --git a/.expeditor/habitat-test.pipeline.yml b/.expeditor/habitat-test.pipeline.yml
index f18957c653..8f46de4784 100644
--- a/.expeditor/habitat-test.pipeline.yml
+++ b/.expeditor/habitat-test.pipeline.yml
@@ -3,6 +3,8 @@ steps:
- label: ":windows: Validate Habitat Builds of Chef Infra"
commands:
+ - powershell -File "./scripts/ci/ensure-minimum-viable-hab.ps1"
+ - 'Write-Host "--- :hammer_and_wrench: Installing $EXPEDITOR_PKG_IDENTS_CHEFINFRACLIENTX86_64WINDOWS"'
- hab pkg install "$EXPEDITOR_PKG_IDENTS_CHEFINFRACLIENTX86_64WINDOWS"
- powershell -File "./habitat/tests/test.ps1" -PackageIdentifier "$EXPEDITOR_PKG_IDENTS_CHEFINFRACLIENTX86_64WINDOWS"
expeditor:
diff --git a/scripts/ci/ensure-minimum-viable-hab.ps1 b/scripts/ci/ensure-minimum-viable-hab.ps1
new file mode 100644
index 0000000000..175c7d4890
--- /dev/null
+++ b/scripts/ci/ensure-minimum-viable-hab.ps1
@@ -0,0 +1,9 @@
+$hab_version = (hab --version)
+$hab_minor_version = $hab_version.split('.')[1]
+if ( -not $? -Or $hab_minor_version -lt 85 ) {
+ 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"
+}
diff --git a/scripts/ci/verify-plan.ps1 b/scripts/ci/verify-plan.ps1
index d65f592e9f..bf206fab9c 100644
--- a/scripts/ci/verify-plan.ps1
+++ b/scripts/ci/verify-plan.ps1
@@ -12,20 +12,12 @@ $Plan = 'chef-infra-client'
Write-Host "--- :8ball: :windows: Verifying $Plan"
-$hab_version = (hab --version)
-$hab_minor_version = $hab_version.split('.')[1]
-if ( -not $? -Or $hab_minor_version -lt 85 ) {
- Write-Host "--- :habicat: Installing the version of Habitat required"
- install-habitat --version 0.85.0.20190916
-} else {
- Write-Host "--- :habicat: :thumbsup: Minimum required version of Habitat already installed"
-}
-
+powershell -File "./scripts/ci/ensure-minimum-viable-hab.ps1"
+if (-not $?) { throw "Could not ensure the minimum hab version required is installed." }
Write-Host "--- :key: Generating fake origin key"
hab origin key generate $env:HAB_ORIGIN
-
$project_root = "$(git rev-parse --show-toplevel)"
Set-Location $project_root