This repository contains the Bento project, which provides:
- Ruby CLI Wrapper: A Ruby gem (
bento) that wraps Hashicorp Packer for building Vagrant boxes - Packer Templates: HCL-based Packer templates for building Vagrant base boxes across multiple operating systems and providers
- Language: Ruby 3.0+
- Main Executable:
bin/bento - Library Code:
lib/bento/ - Key Features: Build, test, upload, list, and normalize Vagrant boxes
- Dependencies: mixlib-shellout, Packer, Vagrant
- Language: HCL (HashiCorp Configuration Language)
- Templates Directory:
packer_templates/ - OS Variable Files:
os_pkrvars/(organized by OS family) - Supported Providers: VirtualBox, VMware, Parallels, UTM, QEMU, Hyper-V
- Supported Architectures: x86_64, aarch64
Before committing any changes, you MUST run the following linters based on the files modified:
Ruby Files (*.rb, Rakefile, *.gemspec):
bundle install
bundle exec cookstyle -a .Markdown Files (*.md):
# Markdown linting is performed via GitHub Actions
# Local testing not required but verify links workYAML Files (*.yml, *.yaml):
# YAML linting is performed via GitHub Actions
# Ensure valid YAML syntaxShell Scripts (*.sh):
shellcheck *.shPowerShell Scripts (*.ps1):
# PowerShell linting is performed via GitHub ActionsPacker Templates (*.pkr.hcl, *.pkrvars.hcl):
cd /path/to/bento
packer init -upgrade ./packer_templates
packer validate -var-file=os_pkrvars/<os>/<template>.pkrvars.hcl ./packer_templatesAll Packer Templates (Comprehensive Validation):
bundle exec rake validateFor Ruby Code Changes:
# Install all dependencies (includes test-kitchen, kitchen-vagrant, and rspec)
bundle install
# Run the RSpec unit test suite
bundle exec rspec
# or equivalently:
bundle exec rake spec
# (bundle exec rake also runs spec by default)
# Run the bento CLI commands to verify functionality
bento list
bento build --dry-run os_pkrvars/<test-template>.pkrvars.hclRSpec test suite is located in spec/ and covers all library modules:
spec/bento/common_spec.rb— Common module helpersspec/bento/buildmetadata_spec.rb— BuildMetadataspec/bento/providermetadata_spec.rb— ProviderMetadataspec/bento/packerexec_spec.rb— PackerExecspec/bento/runner_spec.rb— BuildRunnerspec/bento/test_spec.rb— TestRunnerspec/bento/upload_spec.rb— UploadRunner
For Packer Template Changes:
# Validate the specific template
packer validate -var-file=os_pkrvars/<os>/<modified-template>.pkrvars.hcl ./packer_templates
# If possible, run a test build (requires hypervisor)
bento build os_pkrvars/<os>/<modified-template>.pkrvars.hcl
# Test with kitchen (if applicable)
bento testREADME.md - Update if:
- Adding new features to the bento CLI
- Changing CLI command syntax or options
- Adding/removing supported operating systems
- Modifying build requirements or prerequisites
- Changing installation instructions
CHANGELOG.md - Update for:
- ALL user-facing changes (bug fixes, features, breaking changes)
- New OS support or version updates
- Provider support changes (VirtualBox, VMware, etc.)
- Ruby gem version changes
- Template modifications affecting builds
Format for CHANGELOG.md:
## Builds for version <VERSION>
[Add/update the build matrix table showing supported OS and providers]
### Changes
- Added support for [OS Name] version [X.Y]
- Fixed [issue description]
- Updated [component] to improve [functionality]
- BREAKING: [description of breaking change]TESTING.md - Update if:
- Changing test procedures
- Adding new test requirements
- Modifying how
bento testworks
lib/bento/cli.rb- Command-line interface definitionslib/bento/runner.rb- Build orchestration logiclib/bento/packerexec.rb- Packer command executionlib/bento/test.rb- Test kitchen integration (uses Kitchen Ruby API directly viarequire 'kitchen'; no shell-out)lib/bento/upload.rb- Vagrant Cloud upload logiclib/bento/buildmetadata.rb- Metadata generationbento.gemspec- Gem specification and dependencies (test-kitchenandkitchen-vagrantare runtime deps)spec/- RSpec unit tests for all library modules.rspec- RSpec configuration (documentation format, color output)
packer_templates/pkr-variables.pkr.hcl- Variable definitionspacker_templates/pkr-sources.pkr.hcl- Provider source configurationspacker_templates/pkr-builder.pkr.hcl- Build orchestrationpacker_templates/pkr-plugins.pkr.hcl- Required Packer pluginsos_pkrvars/<os>/<os>-<version>-<arch>.pkrvars.hcl- OS-specific variables
builds.yml- Build configuration (public boxes, architectures, exclusions)Rakefile- Build automation tasks
# Ensure dependencies are installed
bundle install
packer init -upgrade ./packer_templates# For Ruby changes: run cookstyle frequently
bundle exec cookstyle -a .
# For Packer changes: validate as you go
packer validate -var-file=os_pkrvars/<os>/<template>.pkrvars.hcl ./packer_templates# Run all linters for modified file types
bundle exec cookstyle -a . # Ruby files
shellcheck *.sh # Shell scripts
bundle exec rake validate # All Packer templates
# Update documentation
# - Update CHANGELOG.md with your changes
# - Update README.md if adding features or changing usage
# - Verify all documentation is accurate<type>(<scope>): <subject>
<body>
<footer>
Types: feat, fix, docs, style, refactor, test, chore Scopes: cli, packer, templates, ubuntu, windows, etc.
Examples:
feat(templates): add Ubuntu 25.10 support
- Add os_pkrvars for Ubuntu 25.10 x86_64 and aarch64
- Update builds.yml to include new version
- Add to CHANGELOG.md build matrix
Closes #123
fix(cli): correct memory allocation for virtualbox builds
The --mem option was not being passed correctly to packer.
Fixed argument handling in packerexec.rb.
- Create
os_pkrvars/<os>/<os>-<version>-<arch>.pkrvars.hcl - Validate:
packer validate -var-file=os_pkrvars/<os>/<new-template>.pkrvars.hcl ./packer_templates - Update
builds.ymlif the OS should be public - Update
CHANGELOG.mdwith the new OS in the build matrix - Update
README.mdif it's a significant addition - Run:
bundle exec rake validateto ensure all templates still validate
- Edit files in
lib/bento/ - Run unit tests:
bundle exec rspec - Run linter:
bundle exec cookstyle -a . - Test:
gem build bento.gemspec && gem install bento-*.gem - Verify:
bento list,bento build --dry-run <template> - Update
README.mdif CLI usage changes - Update
CHANGELOG.mdwith the feature or fix
- Edit
packer_templates/*.pkr.hcl - Validate:
bundle exec rake validate - Test with a sample build:
bento build os_pkrvars/ubuntu/ubuntu-24.04-x86_64.pkrvars.hcl - Update
CHANGELOG.mdif behavior changes - Update
README.mdif new features are available
- Always run linters before committing - CI will fail if linting errors exist
- Keep CHANGELOG.md current - It serves as the release notes
- Test your changes - Especially for Packer templates, validate before submitting
- Documentation is code - Outdated docs are bugs
- Architecture awareness - Many templates are architecture-specific (x86_64 vs aarch64)
- Provider compatibility - Not all OS/architecture combinations work with all providers
- Build times - Packer builds can take 30+ minutes; use
--dry-runfor quick validation - Vagrant Cloud - The
bento uploadcommand publishes to https://app.vagrantup.com/bento
The repository uses GitHub Actions for:
- Linting (YAML, JSON, XML, Shell, PowerShell, Markdown, Packer)
- Packer ISO URL validation
- Automated builds per provider and architecture
- PR validation
See .github/workflows/ for workflow definitions.
- Packer Documentation: https://www.packer.io/docs
- Vagrant Documentation: https://www.vagrantup.com/docs
- Chef Bento Boxes: https://app.vagrantup.com/bento
- Kitchen-Vagrant: https://github.com/test-kitchen/kitchen-vagrant