summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobb Kidd <robb@thekidds.org>2020-04-25 14:56:49 -0400
committerRobb Kidd <rkidd@chef.io>2020-04-28 11:50:00 -0400
commit62b93bc099ee4ed5bf059620b9aad8b3341756b3 (patch)
treeda62f894563f1356a3d6aa05cc34a510ce0baf9a
parent5f7a1dfa1a9d784f0993f1299eb888254b9d1398 (diff)
downloadchef-62b93bc099ee4ed5bf059620b9aad8b3341756b3.tar.gz
add status code checks after bare commands
Need these so the PowerShell script will exit when bare commands fail. Otherwise the build just keeps truckin' and the errors just pile up. Signed-off-by: Robb Kidd <robb@thekidds.org>
-rw-r--r--habitat/plan.ps15
1 files changed, 5 insertions, 0 deletions
diff --git a/habitat/plan.ps1 b/habitat/plan.ps1
index ca40a13bda..f1ec962a94 100644
--- a/habitat/plan.ps1
+++ b/habitat/plan.ps1
@@ -44,6 +44,7 @@ function Invoke-Download() {
try {
Push-Location (Resolve-Path "$PLAN_CONTEXT/../").Path
git archive --format=zip --output="${HAB_CACHE_SRC_PATH}/${pkg_filename}" HEAD
+ if (-not $?) { throw "unable to create archive of source" }
} finally {
Pop-Location
}
@@ -62,6 +63,7 @@ function Invoke-Prepare {
Write-BuildLine " ** Configuring bundler for this build environment"
bundle config --local without server docgen maintenance pry travis integration ci chefstyle
+ if (-not $?) { throw "unable to configure bundler to restrict gems to be installed" }
bundle config --local jobs 4
bundle config --local retry 5
bundle config --local silence_root_warning 1
@@ -76,14 +78,17 @@ function Invoke-Build {
Write-BuildLine " ** Using bundler to retrieve the Ruby dependencies"
bundle install
+ if (-not $?) { throw "unable to install gem dependencies" }
Write-BuildLine " ** Running the chef project's 'rake install' to install the path-based gems so they look like any other installed gem."
bundle exec rake install # this needs to be 'bundle exec'd because a Rakefile makes reference to Bundler
+ if (-not $?) { throw "unable to install the gems that live in directories within this repo" }
Write-BuildLine " ** Also 'rake install' any gem sourced as a git reference."
foreach($git_gem in (Get-ChildItem "$env:GEM_HOME/bundler/gems")) {
try {
Push-Location $git_gem
Write-BuildLine " -- and $git_gem too"
rake install # this needs to NOT be 'bundle exec'd else bundler complains about dev deps not being installed
+ if (-not $?) { throw "unable to install $git_gem as a plain old gem" }
} finally {
Pop-Location
}