You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: habitat/bin/kitchen
+10-6Lines changed: 10 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -3,10 +3,9 @@
3
3
origin="praj"
4
4
package="chef-test-kitchen-enterprise"
5
5
cmd="kitchen"
6
-
env_version=$KITCHEN_VERSION
7
-
ruby_path=$(hab pkg path core/ruby3_1)
6
+
env_version=$KITCHEN_VERSION# setup in the OS env for the user running the application
8
7
pkg_path=$(hab pkg path $origin/$package)
9
-
hab_context=$TKE_VERSION
8
+
hab_context=$TKE_VERSION# setup in the plan.sh
10
9
11
10
# When the user does not binlink the hab pkg, hab pkg exec will use this script -> in $pkg_path/bin/kitchen
12
11
# $pkg_path/bin/kitchen will call $pkg_path/vendor/bin/kitchen which will in turn call $pkg_path/vendor/gems/chef-test-kitchen-enterprise-${pkg_version}/bin/kitchen
@@ -21,21 +20,26 @@ if [[ -z "$hab_context" ]]; then
21
20
# This script is being executed as the binlinked script hence it is safe to call the hab pkg exec
22
21
if [[ -z"$env_version" ]];then
23
22
# Execute latest installed version (not version that was last installed)
23
+
echo"KITCHEN_VERSION is not set in the environment; The script is running as a binlinked script (Not in the hab context)"
24
24
hab pkg exec$origin/$package$cmd"$@"
25
25
else# the KITCHEN_VERSION could be in the form <semver> or <semver/date>
26
26
# Do not need to export any paths since the hab pkg exec will have the GEM_PATH and PATH available
27
27
# This will effectively call this same script but in the hab context, since TKE_VERSION will be available.
28
-
hab pkg exec$origin/$package/$env_version"$@"
28
+
echo"KITCHEN_VERSION: $env_version set in the environment; The script is running as a binlinked script (Not in the hab context)"
29
+
hab pkg exec$origin/$package/$env_version$cmd"$@"
29
30
fi
30
31
else#in hab context
31
32
# The script is being executed as hab pkg exec
32
33
# The GEM_PATH and PATH will be available as setup in `hab pkg env`
34
+
# env_version is available in the hab context for the same user, if running as root pass the env variables with the -E flag.
33
35
if [[ -z"$env_version" ]];then
34
36
# Execute latest installed version (not version that was last installed)
echo"KITCHEN_VERSION is not set in the environment; The script is running as hab pkg exec or calling itself recursively from the binlinked script (In the hab context)"
echo"KITCHEN_VERSION: $env_version set in the environment; The script is running as hab pkg exec or calling itself recursively from the binlinked script (In the hab context)"
0 commit comments