Skip to content

Added Appbundler support in linux hab pkg#168

Merged
sanghinitin merged 3 commits into
mainfrom
appbundler_linux
Jun 3, 2026
Merged

Added Appbundler support in linux hab pkg#168
sanghinitin merged 3 commits into
mainfrom
appbundler_linux

Conversation

@sanghinitin

@sanghinitin sanghinitin commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Replaces the hand-rolled wrap_ruby_knife / wrap_bin_with_ruby pattern in habitat/plan.sh with the standard appbundler gem approach, following the same patterns adopted in This will also fix https://progresssoftware.atlassian.net/browse/CHEF-33638

What changed and why

  • Switched binstub strategy from wrap_bin_with_ruby to appbundler – The old wrapper hardcoded a gem path that could drift as gem versions changed and did not pin dependency versions at startup. Appbundler reads Gemfile.lock and emits gem "name", "= VERSION" activation calls for every pinned dep, eliminating "ambiguous specs" warnings and ensuring reproducible load-time behaviour.
  • Added binstub_patch.rb – Injected into every appbundler-generated binstub via sed at build time. Sets APPBUNDLER_ALLOW_RVM=true (prevents appbundler from clearing the carefully constructed Habitat runtime GEM_PATH) and prepends the vendor path so the binstub is runnable directly without the wrapper.
  • Dual-store GEM_HOME / GEM_PATH layoutbundle install (with --local path vendor/) places Gemfile deps under vendor/ruby/3.4.0/ (bundler subdirectory); gem install knife-*.gem with --ignore-dependencies places knife itself under vendor/ (flat GEM_HOME). The libexec wrapper sets GEM_HOME=vendor/ruby/3.4.0 and GEM_PATH=vendor/ so both stores are visible.
  • Added lifecycle hooksdo_prepare (creates /usr/bin/env symlink), do_after (removes .github/ dirs from vendored gems), do_strip (no-op to prevent Habitat stripping Ruby binaries), do_end (cleans up symlink).
  • Simplified Habitat CI test helper – Removed version-pinned installer and verbose debug logging from artifact.habitat.test.ps1; now uses the always-latest standard install script.

Files / paths touched

  • habitat/plan.sh – Complete rework of do_setup_environment, do_install; removed wrap_ruby_knife / wrap_bin_with_ruby; added appbundler workflow with libexec wrapper; added core/sed to build deps; added do_prepare, do_after, do_strip, do_end.
  • binstub_patch.rb – New file at repo root; patched into binstubs by do_install.
  • .expeditor/buildkite/artifact.habitat.test.ps1 – Simplified Install-Habitat function; removed $HabitatVersion pin; removed verbose debug logging.

Evidence

Before / After

AspectBeforeAfter
Binstub strategy Custom wrap_bin_with_ruby bash wrapper with hardcoded $GEM_PATH Appbundler-generated binstub with per-dep gem "x","= VERSION" activation + libexec wrapper
Dep version pinning None – any version in GEM_PATH resolved at runtime Exact Gemfile.lock versions activated by appbundler before Kernel.load
Ambiguous-specs warning Possible when multiple versions present Eliminated via --ignore-dependencies + dual-store separation
Dynamic plugin loading Relied on $HOME/.hab/knife/ruby/ (unresolvable in Habitat context) Supported by appbundler open-gemset design; APPBUNDLER_ALLOW_RVM=true preserves GEM_PATH

Tests / logs

Command : bundle exec rspec spec/unit/
Result  : 1339 examples, 0 failures, 2 pending
Pending : 2 pre-existing expected-pending examples (color terminal + lazy-load isolation)
Duration: 5.01 seconds (load: 17.13 s)

Delegation checklist

Risk & Rollback

  • Risk: Low — build-time change only; knife functional behaviour is unchanged. Appbundler is already the standard pattern across Chef ecosystem projects.
  • Rollback: revert commit 11857c2
git revert 11857c2 --no-edit
git push origin main

Signed-off-by: nitin sanghi <nsanghi@progress.com>
@sanghinitin
sanghinitin requested review from a team and jaymzh as code owners June 2, 2026 11:56
@sanghinitin sanghinitin added the ai-assisted Work completed with AI assistance following Progress AI policies label Jun 2, 2026
Signed-off-by: nitin sanghi <nsanghi@progress.com>
Comment thread habitat/plan.sh
Comment thread habitat/plan.sh Outdated
Signed-off-by: nitin sanghi <nsanghi@progress.com>
@sanghinitin
sanghinitin merged commit f2ee4b9 into main Jun 3, 2026
49 checks passed
@sanghinitin
sanghinitin deleted the appbundler_linux branch June 3, 2026 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-assisted Work completed with AI assistance following Progress AI policies

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants