fix(railpack): interpolate build-time env variables by sourcing build… - #10768
andrasbacsai merged 3 commits into
Conversation
…-time .env Railpack builds forwarded build-time variables inline as `env 'KEY=VALUE'`, which single-quotes each value and prevents shell interpolation. References like BETTER_AUTH_URL=$COOLIFY_URL reached the build as the literal string "$COOLIFY_URL" instead of the resolved URL, breaking builds that validate their env (e.g. SvelteKit/better-auth). Wrap the railpack `docker buildx build` invocation with the same wrap_build_command_with_env_export() helper used by the Dockerfile and Nixpacks build paths, sourcing the build-time .env file (which writes COOLIFY_* first and double-quotes normal vars to allow $VAR expansion). Only buildpack control variables (NIXPACKS_/RAILPACK_), excluded from that file and never needing interpolation, remain inline. Secret flags are unchanged and read the interpolated values from the exported environment. Fixes coollabsio#10736
|
Thank you for the PR! 💜 |
|
@coderabbitai review |
✅ Action performedReview finished.
|
Walkthrough
I'll be back... after reviewing this diff. 🤖 Good news: no serverless nonsense here — just a real server doing real build work. I'd celebrate with a taco but the build ✨ 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.
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 `@tests/Unit/ApplicationDeploymentRailpackConfigTest.php`:
- Around line 286-322: The `save_buildtime_environment_variables` unit test is
still hitting the database because `pull_request_id === 0` makes the code call
the `environment_variables()` relation query instead of using the
`setRelation('environment_variables', ...)` stub. Update this test to avoid the
real relation query by stubbing/mocking the `environment_variables` relation
path used by
`ApplicationDeploymentRailpackConfig::save_buildtime_environment_variables`, or
move the scenario to a Feature test if it must exercise the database-backed
relation.
🪄 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: 05840122-d176-4fbb-a306-b8aef9723237
📒 Files selected for processing (2)
app/Jobs/ApplicationDeploymentJob.phptests/Unit/ApplicationDeploymentRailpackConfigTest.php
Changes
Issues
Category
Preview
AI Assistance
If AI was used:
Testing
Unit tests (
tests/Unit/ApplicationDeploymentRailpackConfigTest.php):/artifacts/build-time.envand no longer forwardsuser/Coolify variables inline as single-quoted literals.
BETTER_AUTH_URL=$COOLIFY_URL).End-to-end (Railpack app, build-time var
BETTER_AUTH_URL=$COOLIFY_URL):printenv BETTER_AUTH_URL→http://railpack-bun.127.0.0.1.sslip.io(the resolved
$COOLIFY_URL), instead of the literal$COOLIFY_URL.build.shcontainsset -a && source /artifacts/build-time.env && set +abeforedocker buildx build.Contributor Agreement
Important