2019-10-17 02:57:45 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -ueo pipefail
|
|
|
|
|
|
|
|
export HAB_ORIGIN='ci'
|
|
|
|
export PLAN='inspec'
|
2019-10-21 21:46:04 +00:00
|
|
|
export CHEF_LICENSE="accept-no-persist"
|
2019-10-21 23:16:37 +00:00
|
|
|
export HAB_LICENSE="accept-no-persist"
|
2019-10-17 02:57:45 +00:00
|
|
|
|
|
|
|
echo "--- system details"
|
|
|
|
uname -a
|
|
|
|
|
|
|
|
echo "--- Generating fake origin key"
|
2019-10-19 00:56:42 +00:00
|
|
|
hab origin key generate $HAB_ORIGIN
|
2019-10-22 06:23:17 +00:00
|
|
|
HAB_CI_KEY=$(realpath "$HOME"/.hab/cache/keys/"$HAB_ORIGIN"*.pub)
|
2019-10-22 06:01:19 +00:00
|
|
|
export HAB_CI_KEY
|
2019-10-17 02:57:45 +00:00
|
|
|
|
|
|
|
echo "--- Building $PLAN"
|
|
|
|
project_root="$(git rev-parse --show-toplevel)"
|
|
|
|
cd "$project_root"
|
|
|
|
|
|
|
|
DO_CHECK=true hab pkg build .
|
|
|
|
|
2019-10-21 20:20:48 +00:00
|
|
|
echo "--- Sourcing 'results/last_build.sh'"
|
2019-10-21 20:31:37 +00:00
|
|
|
if [ -f ./results/last_build.env ]; then
|
|
|
|
. ./results/last_build.env
|
2019-10-19 00:56:42 +00:00
|
|
|
fi
|
2019-10-17 02:57:45 +00:00
|
|
|
|
2019-10-22 03:21:26 +00:00
|
|
|
echo "+++ Installing ${pkg_ident:?is undefined}"
|
2019-10-21 21:11:47 +00:00
|
|
|
|
2019-10-22 04:01:37 +00:00
|
|
|
whoami
|
2019-10-22 05:50:24 +00:00
|
|
|
echo "$HAB_CI_KEY"
|
2019-10-22 03:52:24 +00:00
|
|
|
|
2019-10-22 06:59:41 +00:00
|
|
|
sudo -E -- sh -c cat "$HAB_CI_KEY" | /usr/bin/hab origin key import && hab pkg install "./results/${pkg_artifact:?is undefined}"
|
2019-10-22 03:21:26 +00:00
|
|
|
|
2019-10-22 06:27:53 +00:00
|
|
|
echo "+++ Testing $PLAN"
|
|
|
|
pushd "$project_root/test/artifact"
|
|
|
|
rake
|
|
|
|
popd
|