Cleanup packaging scripts#2782
Conversation
WalkthroughThe director, health monitor, and NATS packaging scripts now discover gemspecs with glob-based loops, build gems from their package directories, and move generated gems into Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/director/packaging (1)
10-16: 🎯 Functional Correctness | 🔴 Critical | ⚡ Quick winPass the gemspec file to
gem buildin all three packaging scripts.RubyGems expects a gemspec argument, so these loops will exit on the first iteration with
set -e.
packages/director/packaging#L10-L16:gem build "$(basename "$gemspec")"packages/health_monitor/packaging#L7-L13:gem build "$(basename "$gemspec")"packages/nats/packaging#L11-L17:gem build "$(basename "$gemspec")"🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/director/packaging` around lines 10 - 16, Update the gem build loops in packages/director/packaging lines 10-16, packages/health_monitor/packaging lines 7-13, and packages/nats/packaging lines 11-17 to pass the current gemspec filename to gem build using the existing gemspec variable and basename handling.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@packages/director/packaging`:
- Around line 10-16: Update the gem build loops in packages/director/packaging
lines 10-16, packages/health_monitor/packaging lines 7-13, and
packages/nats/packaging lines 11-17 to pass the current gemspec filename to gem
build using the existing gemspec variable and basename handling.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 3590585f-42e8-4bca-aeff-8b42a02de434
📒 Files selected for processing (3)
packages/director/packagingpackages/health_monitor/packagingpackages/nats/packaging
There was a problem hiding this comment.
Pull request overview
This PR cleans up BOSH release package packaging scripts for nats, health_monitor, and director, aiming to simplify directory creation, gem building, and what gets copied into ${BOSH_INSTALL_TARGET}.
Changes:
- Consolidate install-target directory creation and improve quoting.
- Refactor gem build loop to iterate over gemspecs and populate
vendor/cache. - Copy
Gemfile,Gemfile.lock, and.bundleinto${BOSH_INSTALL_TARGET}in one command.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| packages/nats/packaging | Refactors gem build + caching flow; adjusts install target setup and file copying. |
| packages/health_monitor/packaging | Refactors gem build + caching flow; adjusts install target setup and file copying. |
| packages/director/packaging | Refactors gem build + caching flow; adjusts install target setup and file copying. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
c2e482c to
dee39a1
Compare
This file is created by the `bosh_bundle_local` function used to install gems during packaging, but because the function is not executed while in `$BOSH_INSTALL_TARGET` the `.bundle/` directory is not present in the package.
dee39a1 to
5165b78
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/director/packaging`:
- Around line 11-14: Update the gem build loops in packages/director/packaging
(lines 11-14), packages/health_monitor/packaging (lines 8-11), and
packages/nats/packaging (lines 12-15) to run gem build from each gemspec’s
directory before moving the generated artifact into vendor/cache; preserve the
existing gemspec iteration and destination behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: b1e98116-63d5-4da8-9eb7-d83d000a48f5
📒 Files selected for processing (3)
packages/director/packagingpackages/health_monitor/packagingpackages/nats/packaging
This appears to be a vestage from when Ruby shipped with a default json gem that was > 2.0. This is no longer the case.
5165b78 to
1e00b83
Compare
There was a problem hiding this comment.
♻️ Duplicate comments (1)
packages/director/packaging (1)
11-14: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winIncorrect
gem buildworking directory context.While updating the
mvcommand to search in the current directory (./*.gem) resolves the immediate "file not found" error during the script run,gem buildis still being executed from the parent directory (working_dir).Gemspec files are designed to be evaluated from their own directory. Building from a parent directory causes relative path resolutions inside the gemspec (like
Dir.glob("lib/**/*")orFile.read("VERSION")) to evaluate against the parent directory context instead of the gem's source tree. This can silently produce a broken or completely empty.gemartifact.Change into the gemspec's directory before executing the build to ensure the Ruby code inside the spec resolves paths accurately.
packages/director/packaging#L11-L14: rungem buildfrom the gemspec's directory inside a subshell.packages/health_monitor/packaging#L8-L11: rungem buildfrom the gemspec's directory inside a subshell.packages/nats/packaging#L12-L15: rungem buildfrom the gemspec's directory inside a subshell.🛠️ Proposed fix
Wrap the loop body in a subshell
(...)so the directory context is cleanly isolated per iteration (which also safely works withset -e). Apply this pattern across all three packaging files:for gemspec in ./bosh-*/*.gemspec; do - gem build "${gemspec}" - mv ./*.gem "${working_dir}/vendor/cache/" + ( + cd "$(dirname "${gemspec}")" + gem build "$(basename "${gemspec}")" + mv ./*.gem "${working_dir}/vendor/cache/" + ) done🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/director/packaging` around lines 11 - 14, The packaging loops build each gemspec from the parent directory, so relative paths resolve incorrectly. In packages/director/packaging lines 11-14, packages/health_monitor/packaging lines 8-11, and packages/nats/packaging lines 12-15, wrap each loop body in a subshell, change into the gemspec’s directory before running gem build, and move the resulting .gem artifact to the existing vendor/cache destination while preserving isolated directory context per iteration.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Duplicate comments:
In `@packages/director/packaging`:
- Around line 11-14: The packaging loops build each gemspec from the parent
directory, so relative paths resolve incorrectly. In packages/director/packaging
lines 11-14, packages/health_monitor/packaging lines 8-11, and
packages/nats/packaging lines 12-15, wrap each loop body in a subshell, change
into the gemspec’s directory before running gem build, and move the resulting
.gem artifact to the existing vendor/cache destination while preserving isolated
directory context per iteration.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: cdd07c16-b3dd-4ffe-a9e8-9838d3864786
📒 Files selected for processing (3)
packages/director/packagingpackages/health_monitor/packagingpackages/nats/packaging
1e00b83 to
3664332
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/director/packaging`:
- Around line 10-16: Harden the gem-building loops in
packages/director/packaging lines 10-16, packages/health_monitor/packaging lines
7-13, and packages/nats/packaging lines 11-17: skip unmatched gemspec globs with
a file-existence guard, create vendor/cache before building, pass each gemspec
basename explicitly to gem build, and redirect pushd/popd output to /dev/null.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: f88bf786-d5ff-4f3a-b55f-35e1e6641665
📒 Files selected for processing (3)
packages/director/packagingpackages/health_monitor/packagingpackages/nats/packaging
No description provided.