Corret build scripts

correct path to hab artifact
Rather than throwing, lets try to install the version
Make sure hab is in the path
we use -b on windows. lets be consistent
export project_root too
picardface
fix regex
execute rake _through_ habitat
make test vrooom
test presence of inspec
strip out clixml bs
... no which on bk.
full path to which
export PATH
test exist on linux/windows

Signed-off-by: Miah Johnson <miah@chia-pet.org>
This commit is contained in:
Miah Johnson 2019-11-06 14:31:47 -08:00
parent 9eff871be1
commit 13a1c30ba6
4 changed files with 25 additions and 8 deletions

View file

@ -3,4 +3,4 @@
set -ueo pipefail
hab origin key import < "$HAB_CI_KEY"
hab pkg install --binlink "./results/${pkg_artifact:?is undefined}"
hab pkg install -b "${project_root:?is undefined}/results/${pkg_artifact:?is undefined}"

View file

@ -15,13 +15,11 @@ Write-Host "--- Installing the version of Habitat required"
$hab_version = (hab --version)
$hab_minor_version = $hab_version.split('.')[1]
if ( -not $? -Or $hab_minor_version -lt 85 ) {
Write-Host "I'm being built with $hab_version. I need at least Hab 0.85.0, because I use the -IsPath option for setting/pushing paths in SetupEnvironment."
throw "unable to build: required minimum version of Habitat not installed"
Install-Habitat --version 0.85.0.20190916
} else {
Write-Host ":habicat: I think I have the version I need to build."
}
Install-Habitat --version 0.85.0.20190916
Write-Host "--- Generating fake origin key"
hab origin key generate $env:HAB_ORIGIN
@ -41,6 +39,8 @@ hab pkg install -b $project_root/results/$pkg_artifact
if (-not $?) { throw "unable to install this build" }
Write-Host "+++ Testing $Plan"
$env:PATH = "C:\hab\bin;$env:PATH"
Push-Location $project_root/test/artifact
rake
if (-not $?) { throw "rake failed" }

View file

@ -25,6 +25,7 @@ echo "--- Sourcing 'results/last_build.sh'"
if [ -f ./results/last_build.env ]; then
. ./results/last_build.env
export pkg_artifact
export project_root
fi
echo "+++ Installing ${pkg_ident:?is undefined}"
@ -35,6 +36,10 @@ HSI="$project_root"/.expeditor/buildkite/artifact.habitat.install.sh
sudo -E "$HSI"
echo "+++ Testing $PLAN"
PATH="/hab/bin:$PATH"
export PATH
pushd "$project_root/test/artifact"
rake
hab pkg exec core/ruby rake
popd

View file

@ -1,12 +1,24 @@
require "minitest/autorun"
class TestArtifactDetect < Minitest::Test
def test_inspec_exists_linux
skip if windows?
refute_match(/no inspec/, `/usr/bin/which inspec`)
end
def test_inspec_exists_windows
skip unless windows?
assert_match(/inspec.bat/, `Get-Command inspec`)
end
def test_detect
exit = nil
out, err = capture_subprocess_io do
assert system("inspec detect --no-color")
exit = system("inspec detect --no-color")
end
assert_match %r{/Platform Details/}, out
assert_empty err
assert_empty err.sub(/#< CLIXML\n/, "")
assert_match(/Platform Details/, out)
assert exit
end
end