From 62b93bc099ee4ed5bf059620b9aad8b3341756b3 Mon Sep 17 00:00:00 2001 From: Robb Kidd Date: Sat, 25 Apr 2020 14:56:49 -0400 Subject: 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 --- habitat/plan.ps1 | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'habitat') 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 } -- cgit v1.2.1