summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorChristopher A. Snapp <csnapp@chef.io>2020-06-30 10:37:19 -0600
committerChristopher A. Snapp <csnapp@chef.io>2020-07-13 13:33:47 -0600
commit1638ab05fe4170d248fd99d3c91ac2a7bbda8e37 (patch)
treeb11a3f29748fdb1879a27be9c4df102ab72cbdaf /scripts
parenta555ea251f8f94df7093e87402187d3644aabdbe (diff)
downloadchef-1638ab05fe4170d248fd99d3c91ac2a7bbda8e37.tar.gz
Add windows + linux hab tests to verify pipeline
This removes the verify/habitat pipeline by bringing windows and linux verification tests into the default verify pipeline. Signed-off-by: Christopher A. Snapp <csnapp@chef.io>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/ci/install-hab.sh20
-rwxr-xr-xscripts/ci/verify-plan.sh37
2 files changed, 57 insertions, 0 deletions
diff --git a/scripts/ci/install-hab.sh b/scripts/ci/install-hab.sh
new file mode 100755
index 0000000000..a59b9ce0f0
--- /dev/null
+++ b/scripts/ci/install-hab.sh
@@ -0,0 +1,20 @@
+#!/usr/bin/env bash
+
+set -euo pipefail
+
+hab_target="$1"
+
+# print error message followed by usage and exit
+error () {
+ local message="$1"
+
+ echo -e "\nERROR: ${message}\n" >&2
+
+ exit 1
+}
+
+[[ -n "$hab_target" ]] || error 'no hab target provided'
+
+echo "--- :habicat: Installing latest version of Habitat"
+rm -rf /hab
+curl https://raw.githubusercontent.com/habitat-sh/habitat/master/components/hab/install.sh | bash -s -- -t "$hab_target"
diff --git a/scripts/ci/verify-plan.sh b/scripts/ci/verify-plan.sh
new file mode 100755
index 0000000000..71aac8d767
--- /dev/null
+++ b/scripts/ci/verify-plan.sh
@@ -0,0 +1,37 @@
+#!/usr/bin/env bash
+
+set -euo pipefail
+
+export HAB_ORIGIN='ci'
+export PLAN='chef-infra-client'
+export CHEF_LICENSE="accept-no-persist"
+export HAB_LICENSE="accept-no-persist"
+
+# print error message followed by usage and exit
+error () {
+ local message="$1"
+
+ echo -e "\nERROR: ${message}\n" >&2
+
+ exit 1
+}
+
+echo "--- :8ball: :linux: Verifying $PLAN"
+project_root="$(git rev-parse --show-toplevel)"
+
+echo "--- :key: Generating fake origin key"
+hab origin key generate "$HAB_ORIGIN"
+
+echo "--- :construction: Building $PLAN (solely for verification testing)"
+(
+ cd "$project_root" || error 'cannot change directory to project root'
+ DO_CHECK=true hab pkg build . || error 'unable to build'
+)
+
+source "${project_root}/results/last_build.env" || error 'unable to determine details about this build'
+
+echo "--- :hammer_and_wrench: Installing $pkg_ident"
+hab pkg install "${project_root}/results/$pkg_artifact" || error 'unable to install this build'
+
+echo "--- :mag_right: Testing $PLAN"
+${project_root}/habitat/tests/test.sh "$pkg_ident" || error 'failures during test of executables'