Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using the chef-test-kitchen-enterprise instead of old one #252

Open
wants to merge 7 commits into
base: workstation-LTS
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ group :test do
gem "rspec-mocks", "~> 3.8"
gem "cookstyle"
gem "chefstyle"
gem "test-kitchen"
gem "faraday_middleware"
gem "chef-test-kitchen-enterprise", git: "https://github.com/chef/chef-test-kitchen-enterprise", branch: "main"
gem "simplecov", require: false
end

Expand Down
3 changes: 2 additions & 1 deletion chef-cli.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,12 @@ Gem::Specification.new do |gem|
gem.add_dependency "mixlib-shellout", ">= 2.0", "< 4.0"
gem.add_dependency "ffi-yajl", ">= 1.0", "< 3.0"
gem.add_dependency "minitar", "~> 0.6"
gem.add_dependency "chef", "~> 18.0"
gem.add_dependency "chef", "= 18.5.0"
Stromweld marked this conversation as resolved.
Show resolved Hide resolved
gem.add_dependency "solve", "< 5.0", "> 2.0"
gem.add_dependency "addressable", ">= 2.3.5", "< 2.9"
gem.add_dependency "cookbook-omnifetch", "~> 0.5"
gem.add_dependency "diff-lcs", ">= 1.0", "< 1.4" # 1.4 changes the output
gem.add_dependency "pastel", "~> 0.7" # used for policyfile differ
gem.add_dependency "license-acceptance", ">= 1.0.11", "< 3"
gem.add_dependency "chef-licensing", "~> 1.0"
end
6 changes: 3 additions & 3 deletions habitat/plan.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ function Invoke-Build {
bundle install

gem build chef-cli.gemspec
Write-BuildLine " ** Using gem to install"
gem install chef-cli-*.gem --no-document

Write-BuildLine " ** Using gem to install"
gem install chef-cli-*.gem --no-document
ruby ./post-bundle-install.rb

If ($lastexitcode -ne 0) { Exit $lastexitcode }
} finally {
Expand Down
2 changes: 2 additions & 0 deletions habitat/plan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ pkg_build_deps=(
core/sed
core/gcc
core/libarchive
core/git
)
pkg_bin_dirs=(bin)
do_setup_environment() {
Expand Down Expand Up @@ -40,6 +41,7 @@ do_build() {
bundle config --local silence_root_warning 1
bundle install
gem build chef-cli.gemspec
ruby ./post-bundle-install.rb
}
do_install() {
export GEM_HOME="$pkg_prefix/vendor"
Expand Down
2 changes: 1 addition & 1 deletion lib/chef-cli/command/shell_init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def run(argv)
return 1
end

env = omnibus_env.dup
env = habitat_env.dup
path = env.delete("PATH")
export(shell_name, "PATH", path)
env.each do |var_name, value|
Expand Down
30 changes: 30 additions & 0 deletions post-bundle-install.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env ruby

gem_home = Gem.paths.home

puts "fixing bundle installed gems in #{gem_home}"

# Install gems from git repos. This makes the assumption that there is a <gem_name>.gemspec and
# you can simply gem build + gem install the resulting gem, so nothing fancy. This does not use
# rake install since we need --conservative --minimal-deps in order to not install duplicate gems.
#
#
puts "gem path #{gem_home}"

Dir["#{gem_home}/bundler/gems/*"].each do |gempath|
puts "#{gempath}"
matches = File.basename(gempath).match(/.*-[A-Fa-f0-9]{12}/)
next unless matches

gem_name = File.basename(Dir["#{gempath}/*.gemspec"].first, ".gemspec")
# FIXME: should strip any valid ruby platform off of the gem_name if it matches

next unless gem_name

puts "re-installing #{gem_name}..."

Dir.chdir(gempath) do
system("gem build #{gem_name}.gemspec") or raise "gem build failed"
system("gem install #{gem_name}*.gem --conservative --minimal-deps --no-document") or raise "gem install failed"
end
end