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

Rebranding Change and the new version and change.log file #11

Merged
merged 20 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
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
2 changes: 1 addition & 1 deletion .expeditor/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@

release_branches:
- main:
version_constraint: 3.*
version_constraint: 1.*

changelog:
rollup_header: Changes not yet released to rubygems.org

Check failure on line 24 in .expeditor/config.yml

View check run for this annotation

Chef Expeditor / Expeditor Config Validation

.expeditor/config.yml#L23-L24

Update inline comments are missing from the Changelog file

pipelines:
- verify:
Expand Down
2,398 changes: 1 addition & 2,397 deletions CHANGELOG.md

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ source "https://rubygems.org"
gemspec
gem "appbundler"
gem "pry"
gem "kitchen-dokken", git: "https://github.com/chef/kitchen-dokken", branch: "hab_testing_branch"
gem "kitchen-inspec", git: "https://github.com/inspec/kitchen-inspec", branch: "temp-point-to-chef-test-kitchen-ent"

group :test do
gem "rake"
gem "rb-readline"
Expand All @@ -17,8 +20,6 @@ end

group :integration do
gem "chef-cli"
gem "kitchen-dokken"
gem "kitchen-inspec"
gem "kitchen-vagrant"
end

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.7.1
1.0.0
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ require "kitchen/version"
require "English"

Gem::Specification.new do |gem|
gem.name = "test-kitchen"
gem.name = "chef-test-kitchen-enterprise"
gem.version = Kitchen::VERSION
gem.license = "Apache-2.0"
gem.authors = ["Fletcher Nichol"]
Expand All @@ -16,7 +16,7 @@ Gem::Specification.new do |gem|
gem.homepage = "https://kitchen.ci/"

# The gemfile and gemspec are necessary for appbundler in ChefDK / Workstation
gem.files = %w{LICENSE test-kitchen.gemspec Gemfile Rakefile} + Dir.glob("{bin,lib,templates,support}/**/*")
gem.files = %w{LICENSE chef-test-kitchen-enterprise.gemspec Gemfile Rakefile} + Dir.glob("{bin,lib,templates,support}/**/*")
gem.executables = %w{kitchen}
gem.require_paths = ["lib"]

Expand All @@ -30,7 +30,7 @@ Gem::Specification.new do |gem|
gem.add_dependency "net-scp", ">= 1.1", "< 5.0" # pinning until we can confirm 4+ works
gem.add_dependency "net-ssh", ">= 2.9", "< 8.0" # pinning until we can confirm 8+ works
gem.add_dependency "net-ssh-gateway", ">= 1.2", "< 3.0" # pinning until we can confirm 3+ works
gem.add_dependency "thor", ">= 0.19", "< 2.0"
gem.add_dependency "thor", ">= 0.19", "< 1.3.0"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why thor needs to be downgraded?

Copy link
Collaborator Author

@sanghinitin sanghinitin Nov 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inspec-core or train-core gem giving error with upgraded version

Copy link
Collaborator

@Vasu1105 Vasu1105 Nov 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add the comments why we downgraded that so that we can track it

gem.add_dependency "winrm", "~> 2.0"
gem.add_dependency "winrm-elevated", "~> 1.0"
gem.add_dependency "winrm-fs", "~> 1.1"
Expand Down
18 changes: 9 additions & 9 deletions habitat/plan.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ $ErrorActionPreference = "Stop"
$PSDefaultParameterValues['*:ErrorAction']='Stop'

$env:HAB_BLDR_CHANNEL = "LTS-2024"
$pkg_name="test-kitchen"
$pkg_name="chef-test-kitchen-enterprise"
$pkg_origin="chef"
$pkg_version=$(Get-Content "$PLAN_CONTEXT/../VERSION")
$pkg_maintainer="The Chef Maintainers <[email protected]>"
Expand Down Expand Up @@ -44,12 +44,12 @@ function Invoke-Build {
bundle config --local silence_root_warning 1
Write-BuildLine " ** Using bundler to retrieve the Ruby dependencies"
bundle install

gem build test-kitchen.gemspec
bundle lock --local
gem build chef-test-kitchen-enterprise.gemspec
Write-BuildLine " ** Using gem to install"
gem install test-kitchen-*.gem --no-document
gem install kitchen-dokken
gem install chef-test-kitchen-enterprise*.gem --no-document

ruby ./post-bundle-install.rb
If ($lastexitcode -ne 0) { Exit $lastexitcode }
} finally {
Pop-Location
Expand All @@ -65,11 +65,11 @@ function Invoke-Install {
try {
Push-Location $pkg_prefix
bundle config --local gemfile $project_root/Gemfile
Write-BuildLine "** generating binstubs for test-kitchen with precise version pins"
Write-BuildLine "** generating binstubs for test-kitchen with precise version pins $project_root $pkg_prefix/bin "
Invoke-Expression -Command "appbundler.bat $project_root $pkg_prefix/bin test-kitchen"
Write-BuildLine "** generating binstubs for chef-test-kitchen-enterprise with precise version pins"
Write-BuildLine "** generating binstubs for chef-test-kitchen-enterprise with precise version pins $project_root $pkg_prefix/bin "
Invoke-Expression -Command "appbundler.bat $project_root $pkg_prefix/bin chef-test-kitchen-enterprise"
If ($lastexitcode -ne 0) { Exit $lastexitcode }
Write-BuildLine " ** Running the test-kitchen project's 'rake install' to install the path-based gems so they look like any other installed gem."
Write-BuildLine " ** Running the chef-test-kitchen-enterprise project's 'rake install' to install the path-based gems so they look like any other installed gem."

If ($lastexitcode -ne 0) { Exit $lastexitcode }
} finally {
Expand Down
121 changes: 41 additions & 80 deletions habitat/plan.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export HAB_BLDR_CHANNEL="LTS-2024"
_chef_client_ruby="core/ruby3_1"
pkg_name="test-kitchen"
pkg_name="chef-test-kitchen-enterprise"
pkg_origin="chef"
pkg_maintainer="The Chef Maintainers <[email protected]>"
pkg_description="The Chef Test Kitchen"
Expand All @@ -11,111 +11,72 @@ pkg_bin_dirs=(
)
pkg_build_deps=(
core/make
core/bash
core/gcc
core/git
)
pkg_deps=(
$_chef_client_ruby
core/coreutils
core/git
)
pkg_svc_user=root

pkg_version() {
cat "${SRC_PATH}/VERSION"
cat "$SRC_PATH/VERSION"
}

do_before() {
do_default_before
update_pkg_version
# We must wait until we update the pkg_version to use the pkg_version
pkg_filename="${pkg_name}-${pkg_version}.tar.gz"
}

do_download() {
build_line "Locally creating archive of latest repository commit at ${HAB_CACHE_SRC_PATH}/${pkg_filename}"
git config --global --add safe.directory /src
# source is in this repo, so we're going to create an archive from the
# appropriate path within the repo and place the generated tarball in the
# location expected by do_unpack
( cd "${SRC_PATH}" || exit_with "unable to enter hab-src directory" 1
git archive --prefix="${pkg_name}-${pkg_version}/" --output="${HAB_CACHE_SRC_PATH}/${pkg_filename}" HEAD
)
}

do_verify() {
build_line "Skipping checksum verification on the archive we just created."
return 0
}

do_setup_environment() {
push_runtime_env GEM_PATH "${pkg_prefix}/vendor"

set_runtime_env APPBUNDLER_ALLOW_RVM "true" # prevent appbundler from clearing out the carefully constructed runtime GEM_PATH
set_runtime_env LANG "en_US.UTF-8"
set_runtime_env LC_CTYPE "en_US.UTF-8"
}

do_prepare() {
export GEM_HOME="${pkg_prefix}/vendor"
export CPPFLAGS="${CPPFLAGS} ${CFLAGS}"

( cd "$CACHE_PATH"
bundle config --local jobs "$(nproc)"
bundle config --local without server docgen maintenance pry travis integration ci
bundle config --local shebang "$(pkg_path_for "$_chef_client_ruby")/bin/ruby"
bundle config --local retry 5
bundle config --local silence_root_warning 1
)

build_line "Setting link for /usr/bin/env to 'coreutils'"
if [ ! -f /usr/bin/env ]; then
ln -s "$(pkg_interpreter_for core/coreutils bin/env)" /usr/bin/env
fi
do_unpack() {
mkdir -pv "$HAB_CACHE_SRC_PATH/$pkg_dirname"
cp -RT "$PLAN_CONTEXT"/.. "$HAB_CACHE_SRC_PATH/$pkg_dirname/"
}

do_build() {
( cd "$CACHE_PATH" || exit_with "unable to enter hab-cache directory" 1
build_line "Installing gem dependencies ..."
bundle install --jobs=3 --retry=3
build_line "Installing gems from git repos properly ..."
build_line "Installing this project's gems ..."
bundle exec rake install:local
gem install chef-utils chef-config appbundler aruba kitchen-dokken
)
echo $(pkg_path_for $_chef_client_ruby)
export GEM_HOME="$pkg_prefix/vendor/gems"

build_line "Setting GEM_PATH=$GEM_HOME"
export GEM_PATH="$GEM_HOME"
bundle config --local without integration deploy maintenance
bundle config --local jobs 4
bundle config --local retry 5
bundle config --local silence_root_warning 1
bundle install
ruby ./post-bundle-install.rb
gem build chef-test-kitchen-enterprise.gemspec
}

do_install() {
( cd "$pkg_prefix" || exit_with "unable to enter pkg prefix directory" 1
export BUNDLE_GEMFILE="${CACHE_PATH}/Gemfile"
build_line "** fixing binstub shebangs"
fix_interpreter "${pkg_prefix}/vendor/bin/*" "$_chef_client_ruby" bin/ruby
export BUNDLE_GEMFILE="${CACHE_PATH}/Gemfile"
for gem in test-kitchen; do
build_line "** generating binstubs for $gem with precise version pins"
appbundler $CACHE_PATH $pkg_prefix/bin $gem
done
)
export GEM_HOME="$pkg_prefix/vendor/gems"

build_line "Setting GEM_PATH=$GEM_HOME"
export GEM_PATH="$GEM_HOME"
gem install chef-test-kitchen-enterprise-*.gem --no-document
wrap_ruby_bin
set_runtime_env "GEM_PATH" "${pkg_prefix}/vendor/gems"
}

do_after() {
build_line "Trimming the fat ..."
wrap_ruby_bin() {
local bin="$pkg_prefix/bin/kitchen"
local real_bin="$GEM_HOME/gems/chef-test-kitchen-enterprise-${pkg_version}/bin/kitchen"
build_line "Adding wrapper $bin to $real_bin"
cat <<EOF > "$bin"
#!$(pkg_path_for core/bash)/bin/bash
set -e

# We don't need the cache of downloaded .gem files ...
rm -r "$pkg_prefix/vendor/cache"
# Set binary path that allows chef-test-kitchen-enterprise to use non-Hab pkg binaries
export PATH="/sbin:/usr/sbin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:\$PATH"

# We don't need the gem docs.
rm -r "$pkg_prefix/vendor/doc"
# We don't need to ship the test suites for every gem dependency,
# only Chef's for package verification.
find "$pkg_prefix/vendor/gems" -name spec -type d | grep -v "chef-${pkg_version}" \
| while read spec_dir; do rm -r "$spec_dir"; done
}
# Set Ruby paths defined from 'do_setup_environment()'
export GEM_HOME="$pkg_prefix/vendor/gems"

do_end() {
if [ "$(readlink /usr/bin/env)" = "$(pkg_interpreter_for core/coreutils bin/env)" ]; then
build_line "Removing the symlink we created for '/usr/bin/env'"
rm /usr/bin/env
fi
export GEM_PATH="$GEM_HOME"
exec $(pkg_path_for $_chef_client_ruby)/bin/ruby $real_bin \$@
EOF
chmod -v 755 "$bin"
}

do_strip() {
Expand Down
2 changes: 1 addition & 1 deletion lib/kitchen/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
# limitations under the License.

module Kitchen
VERSION = "3.7.1".freeze
VERSION = "1.0.0".freeze
end
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

Check failure on line 17 in post-bundle-install.rb

View workflow job for this annotation

GitHub Actions / Chefstyle on Ruby (3.3)

[Correctable] Layout/EmptyLineAfterGuardClause: Add empty line after guard clause.
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

Check failure on line 29 in post-bundle-install.rb

View workflow job for this annotation

GitHub Actions / Chefstyle on Ruby (3.3)

[Correctable] Layout/TrailingWhitespace: Trailing whitespace detected.
end
Empty file added testing/kitchen.yml
Empty file.
Loading