diff options
-rw-r--r-- | .expeditor/config.yml | 8 | ||||
-rw-r--r-- | .expeditor/verify.habitat.pipeline.yml | 20 | ||||
-rw-r--r-- | .expeditor/verify.pipeline.yml | 32 | ||||
-rwxr-xr-x | habitat/tests/test.sh | 35 | ||||
-rwxr-xr-x | scripts/ci/install-hab.sh | 20 | ||||
-rwxr-xr-x | scripts/ci/verify-plan.sh | 37 |
6 files changed, 124 insertions, 28 deletions
diff --git a/.expeditor/config.yml b/.expeditor/config.yml index 090a31808a..e9d5970882 100644 --- a/.expeditor/config.yml +++ b/.expeditor/config.yml @@ -26,14 +26,6 @@ docker_images: pipelines: - verify: public: true - - verify/habitat: - description: > - A temporary pipeline to verify the habitat plans. Performs a local build, - tests it, then throws it away. Its steps should eventually move into the - "verify" pipeline (if fast enough) or this pipeline should be removed in - favor of learning about packaging problems after merge. - definition: .expeditor/verify.habitat.pipeline.yml - trigger: default - habitat/build - habitat/test: definition: .expeditor/habitat-test.pipeline.yml diff --git a/.expeditor/verify.habitat.pipeline.yml b/.expeditor/verify.habitat.pipeline.yml deleted file mode 100644 index 9c50312db5..0000000000 --- a/.expeditor/verify.habitat.pipeline.yml +++ /dev/null @@ -1,20 +0,0 @@ ---- -expeditor: - defaults: - buildkite: - timeout_in_minutes: 60 - retry: - automatic: - limit: 1 - -steps: - -- label: "Windows plan" - commands: - - scripts/ci/verify-plan.ps1 - expeditor: - executor: - windows: - privileged: true - single-use: true - shell: ["powershell", "-Command"] diff --git a/.expeditor/verify.pipeline.yml b/.expeditor/verify.pipeline.yml index 987980aa3a..34a2dee47d 100644 --- a/.expeditor/verify.pipeline.yml +++ b/.expeditor/verify.pipeline.yml @@ -579,3 +579,35 @@ steps: expeditor: executor: docker: + +- label: ":habicat: Linux plan" + commands: + - sudo ./scripts/ci/install-hab.sh 'x86_64-linux' + - sudo ./scripts/ci/verify-plan.sh + timeout_in_minutes: 60 + expeditor: + executor: + linux: + privileged: true + single-use: true + +- label: ":habicat: Linux plan (kernel2)" + commands: + - sudo ./scripts/ci/install-hab.sh 'x86_64-linux-kernel2' + - sudo ./scripts/ci/verify-plan.sh + timeout_in_minutes: 60 + expeditor: + executor: + linux: + privileged: true + single-use: true + +- label: ":habicat: Windows plan" + commands: + - ./scripts/ci/verify-plan.ps1 + expeditor: + executor: + windows: + privileged: true + single-use: true + shell: ["powershell", "-Command"] diff --git a/habitat/tests/test.sh b/habitat/tests/test.sh new file mode 100755 index 0000000000..0882313c8e --- /dev/null +++ b/habitat/tests/test.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bash + +set -euo pipefail + +export CHEF_LICENSE="accept-no-persist" +export HAB_LICENSE="accept-no-persist" + +project_root="$(git rev-parse --show-toplevel)" +pkg_ident="$1" + +# print error message followed by usage and exit +error () { + local message="$1" + + echo -e "\nERROR: ${message}\n" >&2 + + exit 1 +} + +[[ -n "$pkg_ident" ]] || error 'no hab package identity provided' + +package_version=$(awk -F / '{print $3}' <<<"$pkg_ident") + +cd "${project_root}" + +echo "--- :mag_right: Testing ${pkg_ident} executables" +[[ "$package_version" = "$(hab pkg exec "${pkg_ident}" chef-client --version | sed 's/.*: //')" ]] || error "chef-client is not the expected version" + +for executable in 'chef-client' 'ohai' 'chef-shell' 'chef-apply' 'knife' 'chef-solo'; do + echo -en "\t$executable = " + hab pkg exec "${pkg_ident}" "${executable}" --version || error "${executable} failed to execute properly" +done + +echo "--- :mag_right: Testing ${pkg_ident} functionality" +hab pkg exec "${pkg_ident}" rspec -f documentation --tag ~executables spec/functional || error 'failures during rspec tests' 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' |