Skip to content

Commit

Permalink
Merge pull request #30 from skylerto/version
Browse files Browse the repository at this point in the history
install specific version of habitat
  • Loading branch information
John Kerry authored Sep 28, 2018
2 parents 8ae8032 + 914ee0d commit 9c44e71
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/kitchen-habitat/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Kitchen
module Habitat
VERSION = "0.10.0".freeze
VERSION = "0.11.0".freeze
end
end
8 changes: 7 additions & 1 deletion lib/kitchen/provisioner/habitat.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class Habitat < Base
kitchen_provisioner_api_version 2

default_config :depot_url, nil
default_config :hab_version, "latest"
default_config :hab_sup_origin, "core"
default_config :hab_sup_name, "hab-sup"
default_config :hab_sup_version, nil
Expand Down Expand Up @@ -78,13 +79,17 @@ def finalize_config!(instance)

def install_command
raise "Need to fill in some implementation here." if instance.platform == "windows"

version = " -v #{config[:hab_version]}" unless config[:hab_version].eql?("latest")

wrap_shell_code <<-BASH
#{export_hab_bldr_url}
if command -v hab >/dev/null 2>&1
then
echo "Habitat CLI already installed."
else
curl 'https://raw.githubusercontent.com/habitat-sh/habitat/master/components/hab/install.sh' | sudo -E bash
curl -o /tmp/install.sh 'https://raw.githubusercontent.com/habitat-sh/habitat/master/components/hab/install.sh'
sudo -E bash /tmp/install.sh#{version}
fi
BASH
end
Expand Down Expand Up @@ -161,6 +166,7 @@ def run_package_in_background
<<-RUN
[ -f ./run.pid ] && rm -f run.pid
[ -f ./nohup.out ] && rm -f nohup.out
nohup sudo -E hab sup run #{supervisor_options} & echo $! > run.pid
until sudo -E hab svc status
Expand Down
3 changes: 2 additions & 1 deletion spec/kitchen/provisioner/habitat_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ def wrap_command(code, left_pad_length = 10)
"then",
" echo \"Habitat CLI already installed.\"",
"else",
" curl 'https://raw.githubusercontent.com/habitat-sh/habitat/master/components/hab/install.sh' | sudo -E bash",
" curl -o /tmp/install.sh 'https://raw.githubusercontent.com/habitat-sh/habitat/master/components/hab/install.sh'",
" sudo -E bash /tmp/install.sh",
"fi"
]
expect(install_command).to eq(wrap_command(expected_code, 8))
Expand Down

0 comments on commit 9c44e71

Please sign in to comment.