Skip to content

CHEF-35092 - Use appbundler for habitat packaging#472

Merged
sanjain-progress merged 1 commit into
mainfrom
sanjain/use-appbundler
Jun 3, 2026
Merged

CHEF-35092 - Use appbundler for habitat packaging#472
sanjain-progress merged 1 commit into
mainfrom
sanjain/use-appbundler

Conversation

@sanjain-progress
Copy link
Copy Markdown
Contributor

@sanjain-progress sanjain-progress commented Jun 1, 2026

Description

This pull request improves the packaging and installation process for chef-vault in Habitat environments. The main changes include switching to appbundler for binstub generation, cleaning up vendored gems to avoid CVE false positives, and simplifying the Habitat install script.

Packaging and binstub improvements

  • Overhauled habitat/plan.sh to generate binstubs using appbundler with precise version pins, replacing the previous wrap_ruby_bin wrapper function
  • Added binstub_patch.rb to configure APPBUNDLER_ALLOW_RVM and GEM_PATH at runtime, allowing binstubs to run directly
  • Replaced do_setup_environment() with push_runtime_env/set_runtime_env pattern for proper Habitat runtime environment setup
  • Added do_prepare() to create /usr/bin/env symlink when missing
  • Added do_end() to clean up the /usr/bin/env symlink after build
  • Created libexec/ wrapper pattern: binstub is moved to libexec/ and a bash wrapper in bin/ sets up PATH, GEM_HOME, GEM_PATH before exec
  • Added core/sed to pkg_build_deps

Vendored gem cleanup

  • Added cleanup_lint_roller.rb script to remove stray Gemfile.lock files from vendored gems (lint_roller, stackprof-webnav, chef-vault) to appease security scanners
  • Added .github directory removal in habitat/plan.sh (do_after) and habitat/plan.ps1 (Invoke-After) to avoid CVE false positives from vendored gem metadata

Build/test process improvements

  • Simplified Habitat installation in .expeditor/buildkite/artifact.habitat.test.ps1 by removing explicit version pinning ($HabitatVersion) and always installing the latest Habitat
  • Simplified Install-Habitat function to a single Invoke-Expression call
  • Removed redundant project root logging from Windows test script

Files changed

File Change
binstub_patch.rb New — Runtime GEM_PATH configuration for binstubs
cleanup_lint_roller.rb New — Removes stray Gemfile.lock from vendored gems
habitat/plan.sh Modified — Appbundler pattern, lifecycle hooks, .github cleanup
habitat/plan.ps1 Modified — .github directory cleanup in Invoke-After
.expeditor/buildkite/artifact.habitat.test.ps1 Modified — Simplified Habitat install, removed verbose logging

Types of changes

  • Chore (non-breaking change that does not add functionality or fix an issue)

Checklist

  • I have read the CONTRIBUTING document.
  • All new and existing tests passed.
  • All commits have been signed-off for the Developer Certificate of Origin.

- Overhauled habitat/plan.sh to use appbundler for binstub generation
- Added binstub_patch.rb for runtime GEM_PATH configuration
- Added cleanup_lint_roller.rb to remove stray Gemfile.lock from vendored gems
- Added .github directory cleanup in both plan.sh and plan.ps1 to avoid CVE false positives
- Simplified Habitat installation in artifact.habitat.test.ps1 (removed version pinning)
- Removed redundant project root logging from Windows test script
- Replaced wrap_ruby_bin with appbundler + libexec wrapper pattern
- Added do_prepare, do_after, do_end lifecycle hooks in plan.sh

Signed-off-by: Sachin Jain <Sachin.jain@chef.io>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 1, 2026

Simplecov Report

Covered Threshold
98.57% 90%

@sanjain-progress sanjain-progress changed the title Use appbundler for habitat packaging CHEF-35092 - Use appbundler for habitat packaging Jun 2, 2026
@sanjain-progress sanjain-progress merged commit 0ce2981 into main Jun 3, 2026
38 checks passed
@sanjain-progress sanjain-progress deleted the sanjain/use-appbundler branch June 3, 2026 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants