From 997d41ea24f9f46592d288c46d4c7a9ca10b7879 Mon Sep 17 00:00:00 2001 From: Sonu Saha <98935583+ahasunos@users.noreply.github.com> Date: Mon, 12 Aug 2024 18:54:08 +0530 Subject: [PATCH] CHEF-14881: Fix habitat pipeline for InSpec 6 (#7127) * ci: update ruby version used for hab package Signed-off-by: Sonu Saha * ci: update hab pipeline Signed-off-by: Sonu Saha * ci: trigger hab pipeline for raised PR Signed-off-by: Sonu Saha --------- Signed-off-by: Sonu Saha --- .expeditor/buildkite/artifact.habitat.test.sh | 24 +++++++++++++++++++ .expeditor/config.yml | 2 +- habitat/plan.sh | 4 ++-- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/.expeditor/buildkite/artifact.habitat.test.sh b/.expeditor/buildkite/artifact.habitat.test.sh index b930a4224..79da5f649 100755 --- a/.expeditor/buildkite/artifact.habitat.test.sh +++ b/.expeditor/buildkite/artifact.habitat.test.sh @@ -6,7 +6,28 @@ export HAB_ORIGIN='ci' export PLAN='inspec' export CHEF_LICENSE="accept-no-persist" export HAB_LICENSE="accept-no-persist" + +echo "--- checking if git is installed" +if ! command -v git &> /dev/null; then + echo "Git is not installed. Installing Git..." + sudo yum install -y git +else + echo "Git is already installed." + git --version +fi + +echo "--- add an exception for this directory since detected dubious ownership in repository at /workdir" +git config --global --add safe.directory /workdir + +echo "--- git status for this workdir" +git status + +echo "--- ruby version" +ruby -v + export project_root="$(git rev-parse --show-toplevel)" +echo "The value for project_root is: $project_root" + export HAB_NONINTERACTIVE=true export HAB_NOCOLORING=true export HAB_STUDIO_SECRET_HAB_NONINTERACTIVE=true @@ -46,6 +67,9 @@ if [ -f ./results/last_build.env ]; then fi echo "+++ Installing ${pkg_ident:?is undefined}" +echo "++++" +echo $project_root +echo "+++" hab pkg install -b "${project_root:?is undefined}/results/${pkg_artifact:?is undefined}" echo "--- Removing world readability from /usr/local/bundle" diff --git a/.expeditor/config.yml b/.expeditor/config.yml index 5306c234f..aa025bf06 100644 --- a/.expeditor/config.yml +++ b/.expeditor/config.yml @@ -25,7 +25,7 @@ pipelines: - HAB_NONINTERACTIVE: "true" - HAB_NOCOLORING: "true" - HAB_STUDIO_SECRET_HAB_NONINTERACTIVE: "true" - # trigger: pull_request + trigger: pull_request - verify: definition: .expeditor/verify_public_dummy.pipeline.yml description: Keeping the verify pipeline alive to preserve the history diff --git a/habitat/plan.sh b/habitat/plan.sh index ee4219447..a31ec69c6 100644 --- a/habitat/plan.sh +++ b/habitat/plan.sh @@ -10,7 +10,7 @@ pkg_license=('Apache-2.0') pkg_deps=( core/coreutils core/git - core/ruby30 + core/ruby31 core/bash ) pkg_build_deps=( @@ -80,7 +80,7 @@ export PATH="/sbin:/usr/sbin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:\$PATH export GEM_HOME="$GEM_HOME" export GEM_PATH="$GEM_PATH" -exec $(pkg_path_for core/ruby30)/bin/ruby $real_bin \$@ +exec $(pkg_path_for core/ruby31)/bin/ruby $real_bin \$@ EOF chmod -v 755 "$bin" }