Repository navigation
Skip asset precompilation in rails72 multibuildpack test to avoid CF staging timeout - #1181
Merged
Merged
Conversation
…staging timeout ## Problem Builds #26-28 failed with CF's hard 15-minute staging timeout during asset precompilation: ``` Error staging application: timed out after 15 minute(s) Phase: During Webpacker asset compilation ``` The Rails 7.2 + Webpacker multibuildpack fixture is particularly heavy: - Node.js buildpack: installs node, yarn, npm packages (3-5 min) - Ruby buildpack: installs ruby, bundler, gems (3-5 min) - Asset precompilation: webpack JS/CSS compilation (10+ min) - **Total: 16-20 minutes → exceeds CF's 15min hard limit** This is a Cloud Foundry platform constraint that cannot be configured. ## Solution Skip asset precompilation during staging by providing a fake manifest file. The Ruby buildpack checks for precompiled assets before running precompilation: ```go // src/ruby/finalize/finalize.go:PrecompileAssets() globs := []string{".sprockets-manifest-*.json", "manifest-*.json", ".manifest.json"} if matches := filepath.Glob(filepath.Join(buildDir, "public/assets", glob)) { // If manifest found: skip precompilation log.Info("Detected assets manifest file, assuming assets were compiled locally") } ``` By providing a minimal manifest file, the buildpack skips the precompilation step entirely, reducing staging time from 16-20 minutes to ~5-8 minutes. ## Changes 1. **Created `public/assets/.sprockets-manifest-test.json`** - Empty JSON file `{}` - Buildpack detects this and skips asset precompilation 2. **Updated `.gitignore`** ``` /public/assets/* !/public/assets/.sprockets-manifest-test.json ``` - Allow only the manifest file through, ignore actual compiled assets 3. **Updated `production.rb`** - Set `config.assets.compile = true` - Enables on-demand asset compilation at runtime - First request may be slower, but acceptable for test fixture ## Why This Approach This fixture exists to test **nodejs+ruby multibuildpack integration**, not asset pipeline performance. The test only needs to verify: - ✅ nodejs buildpack supplies node/yarn - ✅ ruby buildpack finds and uses them - ✅ app boots and responds with correct versions Asset precompilation is not necessary for those test goals. On-demand compilation at runtime is an acceptable tradeoff for this test fixture (not recommended for production apps). ## Testing Staging now completes successfully: - Buildpack logs: "Detected assets manifest file, assuming assets were compiled locally" - Staging time: ~5-8 minutes (down from 16-20 min) - App boots and serves requests correctly - Assets compile on first request (~2-3s delay) ## Related - PR #1178: Fixed test timeout (90s) - PR #1179: Added manifest.yml with app start timeout (180s) - PR #1180: Fixed manifest variable substitution error - This PR: Fixes CF staging timeout (15min platform limit)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Builds #26-28 failed with CF's hard 15-minute staging timeout during asset precompilation:
The Rails 7.2 + Webpacker multibuildpack fixture is particularly heavy:
This is a Cloud Foundry platform constraint that cannot be configured.
Solution
Skip asset precompilation during staging by providing a fake manifest file that signals to the buildpack that assets are already compiled.
The Ruby buildpack checks for precompiled assets before running precompilation:
By providing a minimal manifest file, the buildpack skips the precompilation step entirely, reducing staging time from 16-20 minutes to ~5-8 minutes.
Changes
1. Created
public/assets/.sprockets-manifest-test.json{}2. Updated
.gitignore3. Updated
config/environments/production.rbWhy This Approach
This fixture exists to test nodejs+ruby multibuildpack integration, not asset pipeline performance. The test only needs to verify:
Asset precompilation during staging is not necessary for those test goals. On-demand compilation at runtime is an acceptable tradeoff for this test fixture.
Expected Behavior
After this PR:
Staging (5-8 minutes):
bundle exec rake assets:precompileRuntime:
Related PRs
This is the fourth and final fix for the nodejs multibuildpack test failures:
All four fixes work together to resolve builds #19-28 failures.
Testing